/* ==========================================================================
   AGENCY BLACK & GOLD THEME - FINAL COMPLETE BUILD
   包含：黑金配色、Masonry瀑布流布局、高级悬停交互、详情页弹窗、防盗保护
   ========================================================================== */

/* 1. 字体引入 (衬线体 + 无衬线体) */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=Inter:wght@300;400;600&display=swap');

/* 2. 全局变量定义 */
:root {
    --bg-color: #050505;        /* 深黑背景 */
    --card-bg: #111111;         /* 卡片背景 */
    --text-primary: #ffffff;    /* 主文字白 */
    --text-secondary: #888888;  /* 次文字灰 */
    
    /* 奢华金渐变体系 */
    --gold-color: #D4AF37; 
    --gold-gradient: linear-gradient(135deg, #BF953F, #FCF6BA, #B38728, #FBF5B7, #AA771C);
    --gold-dim: rgba(212, 175, 55, 0.3);
}

/* 3. 基础重置 */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden; /* 防止横向滚动条 */
    min-height: 100vh;
}

h1, h2, h3 { font-family: 'Playfair Display', serif; }
a { text-decoration: none; transition: 0.3s; color: inherit; }
img { display: block; width: 100%; height: auto; }

/* =========================================
   4. 顶部 Hero 区域 (Header)
   ========================================= */
.hero-header {
    padding: 120px 20px 60px;
    text-align: center;
    background: radial-gradient(circle at top center, #1a1a1a 0%, var(--bg-color) 70%);
}

.site-logo {
    display: block;
    margin: 0 auto 20px;
    height: auto;
    cursor: pointer;
    /* Logo 本身容器可点，内部图片防盗穿透在后面定义 */
}

.hero-title {
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 40px;
    font-weight: 300;
    letter-spacing: 1px;
}

.hero-nav {
    margin-top: 30px;
    border-top: 1px solid var(--gold-dim);
    display: inline-block;
    padding-top: 20px;
}
.hero-nav a {
    color: var(--text-secondary);
    margin: 0 20px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}
.hero-nav a:hover { color: var(--gold-color); }

/* 通用容器 */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.section-block { padding: 100px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
.section-title {
    font-size: 2.5rem;
    margin-bottom: 60px;
    color: var(--gold-color);
    text-align: center;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* =========================================
   5. 服务板块 (Services) - Grid 布局
   ========================================= */
.services-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.service-card {
    background: var(--card-bg);
    border: 1px solid #222;
    transition: 0.4s ease;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    pointer-events: auto; /* 确保可点击 */
}

.service-card:hover {
    border-color: var(--gold-color);
    transform: translateY(-5px);
}

.service-img-wrap {
    width: 100%;
    aspect-ratio: 4/3; /* 固定宽高比 */
    overflow: hidden;
    position: relative;
    border-bottom: 1px solid #222;
    background: #000;
}

.service-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    opacity: 0.8;
}

.service-card:hover .service-img-wrap img {
    transform: scale(1.1);
    opacity: 1;
}

.service-info {
    padding: 30px 20px;
    text-align: center;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.service-num {
    font-family: 'Playfair Display';
    font-size: 2.5rem;
    color: #333;
    margin-bottom: 10px;
    line-height: 1;
    transition: 0.3s;
}
.service-card:hover .service-num { color: var(--gold-dim); }
.service-name {
    font-size: 1.1rem;
    font-weight: 500;
    color: #fff;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* =========================================
   6. 瀑布流作品区 (Waterfall - Masonry.js)
   ========================================= */

/* 容器：必须清除浮动 */
.waterfall {
    display: block;
    width: 100%;
    margin: 0 auto;
    position: relative;
    min-height: 100vh; /* 防止加载时高度塌陷 */
}

/* 标尺与卡片通用设置 */
/* float: left 是为了在 JS 未加载时也能横向排列 */
.grid-sizer, .item {
    width: 31.33%; /* 3列布局 (留余量) */
    float: left;
    margin-bottom: 20px;
    
    /* 关键：使用相对定位，允许 Masonry 覆盖为绝对定位 */
    position: relative;
    
    background: #000; /* 背景黑，配合图片变暗 */
    overflow: hidden;
    cursor: pointer;
    pointer-events: auto; /* 确保可点击 */
}

/* 间隙标尺 */
.gutter-sizer {
    width: 2%;
    float: left;
}

/* --- 图片基础样式 --- */
.item img {
    display: block;
    width: 100%;
    height: auto;
    
    /* 层级控制：在遮罩之下 */
    position: relative;
    z-index: 1;
    
    /* 默认状态 */
    opacity: 1;
    transform: scale(1);
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.4s ease;
    
    /* 稍微降低亮度，更有质感 */
    filter: brightness(0.95);
}

/* --- 遮罩层 (悬停显示区域) --- */
.item-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10; /* 必须高于图片 */
    
    /* 高级黑金渐变背景 */
    background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.95) 100%);
    
    opacity: 0; /* 默认隐藏 */
    transition: opacity 0.4s ease;
    
    /* 内容布局 */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
    
    /* 关键：让点击穿透遮罩层，点到下面的 div 以触发 JS 弹窗 */
    /* 配合下面的防盗逻辑，容器本身可点，内容不可点 */
    pointer-events: none;
}

/* --- 交互动画 --- */

/* 1. 悬停时：显示遮罩 */
.item:hover .item-overlay {
    opacity: 1;
}

/* 2. 悬停时：图片变暗 + 放大 */
.item:hover img {
    transform: scale(1.08); /* 缓慢放大 */
    opacity: 0.4;           /* 变半透明，透出容器的黑色背景 */
}

/* 3. 文字内容上浮动画 */
.item-text {
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.4s ease 0.1s, opacity 0.4s ease 0.1s;
}

.item:hover .item-text {
    transform: translateY(0);
    opacity: 1;
}

/* 标题样式 */
.item-text h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    color: var(--gold-color);
    margin-bottom: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    border-bottom: 2px solid var(--gold-color);
    padding-bottom: 8px;
    display: inline-block;
}

/* 描述样式 */
.item-text p {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.8);
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* =========================================
   7. 详情页弹窗 (Modal)
   ========================================= */
.project-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow-y: auto; /* 允许滚动 */
    padding: 0;
    -webkit-overflow-scrolling: touch; /* iOS 滚动优化 */
    pointer-events: auto !important; /* 确保弹窗可交互 */
}

.project-modal.active { display: block; opacity: 1; }

.modal-scroll-container {
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    pointer-events: auto;
}

.modal-content {
    background: #111;
    width: 100%;
    max-width: 1000px;
    position: relative;
    box-shadow: 0 30px 60px rgba(0,0,0,0.8);
    transform: translateY(30px);
    transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    display: flex;
    flex-direction: column;
    pointer-events: auto;
}

.project-modal.active .modal-content { transform: translateY(0); }

.modal-close-btn {
    position: absolute; top: 20px; right: 20px;
    width: 40px; height: 40px;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    z-index: 20;
    transition: 0.3s;
    line-height: 1;
}
.modal-close-btn:hover { background: var(--gold-color); color: #000; }

.modal-header {
    padding: 60px 40px;
    text-align: center;
    background: #0a0a0a;
    border-bottom: 1px solid #222;
}
.modal-title { font-size: 2.5rem; color: var(--gold-color); margin-bottom: 15px; }
.modal-desc { color: #888; font-size: 1rem; max-width: 600px; margin: 0 auto; line-height: 1.6; }

/* 详情长图堆叠容器 */
.modal-body-stack { width: 100%; background: #000; font-size: 0; pointer-events: auto; }
.modal-body-stack img { width: 100%; height: auto; display: block; margin-bottom: 0; }

/* =========================================
   8. 底部与联系 (Footer)
   ========================================= */
.contact-section {
    padding: 150px 0 100px;
    text-align: center;
    position: relative;
    border-bottom: none;
    background: linear-gradient(to bottom, var(--bg-color) 0%, #0a0a0a 100%);
}
.contact-pre {
    color: var(--gold-color);
    letter-spacing: 4px;
    text-transform: uppercase;
    font-size: 0.9rem;
    margin-bottom: 30px;
    opacity: 0.8;
}
.big-mail {
    display: block;
    font-family: 'Playfair Display', serif;
    font-size: clamp(2rem, 6vw, 6rem);
    font-weight: 700;
    color: #fff;
    line-height: 1.1;
    margin-bottom: 60px;
}
.big-mail:hover {
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #555;
    font-size: 0.85rem;
}
.footer-nav a { margin-left: 20px; color: #666; transition: 0.3s; }
.footer-nav a:hover { color: var(--gold-color); }

/* =========================================
   9. 防盗图设置 (平衡交互与保护)
   ========================================= */

/* 通用图片防盗 */
img {
    /* 视觉防盗 */
    -webkit-user-select: none; user-select: none;
    -webkit-user-drag: none;
    
    /* 核心：禁止长按呼出菜单 (iOS) */
    -webkit-touch-callout: none !important;
    
    /* 核心：点击穿透 */
    /* 让手指直接点在图片下方的 div 容器上，从而保留点击事件，但无法保存图片 */
    pointer-events: none; 
}

/* 针对详情页长图的强力防盗 */
.modal-body-stack img {
    -webkit-touch-callout: none !important;
    pointer-events: none !important;
    -webkit-user-select: none;
    user-select: none;
}

/* 恢复容器的交互能力 (否则点不动) */
.service-card, .item, .site-logo, .modal-content, .modal-scroll-container {
    pointer-events: auto; 
    cursor: pointer;
}

/* =========================================
   10. 响应式适配 (Masonry & Layout)
   ========================================= */
@media(max-width: 800px) {
    /* 平板端：2列 */
    .services-grid { grid-template-columns: 1fr; gap: 40px; }
    .grid-sizer, .item { width: 48%; }
    .gutter-sizer { width: 4%; }
    
    .hero-title { font-size: 2.5rem; }
    .footer-bottom { flex-direction: column; gap: 20px; }
    .footer-nav a { margin: 0 10px; }
    
    .modal-scroll-container { padding: 0; }
    .modal-header { padding: 40px 20px; }
    .modal-title { font-size: 1.8rem; }
    .modal-close-btn { top: 10px; right: 10px; }
}

@media(max-width: 500px) {
    /* 手机端：1列 */
    .grid-sizer, .item { width: 100%; }
    .gutter-sizer { width: 0; }
}

/* 后台按钮通用 */
.btn-grad {
    background: var(--gold-gradient);
    border: none; color: #000; font-weight: 700; padding: 12px 30px;
    cursor: pointer; text-transform: uppercase; letter-spacing: 1px;
}
.btn-grad:hover { filter: brightness(1.1); }



/* ========================================= */
/* === 独立修复：黑金悬停特效 (不影响布局) === */
/* ========================================= */

/* 1. 确保图片容器能隐藏溢出 (用于放大特效) */
.item {
    overflow: hidden; 
    /* 这一行确保遮罩层是相对于 .item 定位的 */
    position: relative; 
}

/* 2. 鼠标悬停时：图片变暗 + 微微放大 */
.item:hover img {
    /* 放大 1.05 倍 */
    transform: scale(1.05); 
    /* 透明度降到 0.5 (透出背景黑)，同时降低亮度 */
    opacity: 0.5;
    filter: brightness(0.7);
    /* 动画平滑过渡 */
    transition: all 0.5s ease;
}

/* 3. 遮罩层 (文字容器) */
.item-overlay {
    /* 绝对定位，盖在图片上 */
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10; /* 层级高于图片 */
    
    /* 渐变背景：上部透明 -> 底部深黑，衬托文字 */
    background: linear-gradient(to bottom, rgba(0,0,0,0) 20%, rgba(0,0,0,0.9) 100%);
    
    /* 默认透明 (隐藏) */
    opacity: 0;
    transition: opacity 0.3s ease;
    
    /* 文字居中排版 */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
    
    /* 关键：让鼠标点击穿透遮罩，点到底下的 .item 上触发弹窗 */
    pointer-events: none; 
}

/* 4. 鼠标悬停时：显示遮罩 */
.item:hover .item-overlay {
    opacity: 1;
}

/* 5. 文字上浮动画 */
.item-text {
    transform: translateY(20px); /* 默认向下沉 */
    opacity: 0;
    transition: all 0.4s ease 0.1s; /* 稍微延迟一点 */
}

.item:hover .item-text {
    transform: translateY(0); /* 上浮复位 */
    opacity: 1;
}

/* 6. 标题与描述样式 (黑金风格) */
.item-text h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    color: var(--gold-color); /* 金色 */
    margin-bottom: 10px;
    border-bottom: 2px solid var(--gold-color);
    padding-bottom: 5px;
    display: inline-block;
    text-shadow: 0 2px 5px rgba(0,0,0,0.8); /* 增加投影防止背景太亮看不清 */
}

.item-text p {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: #fff;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* ========================================= */
/* === Masonry 专用：中心悬停特效 (最终版) === */
/* ========================================= */

.item {
    position: relative; 
    overflow: hidden;
}

/* 1. 全屏遮罩背景 (::before) */
/* 改为全屏半透明黑，不再是底部渐变，这样中间的字才看得清 */
.item::before {
    content: ''; 
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10;
    
    /* 纯黑半透明遮罩 */
    background: rgba(0,0,0,0.7);
    
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none; 
}

/* 2. 居中标题文字 (::after) */
.item::after {
    /* 读取标题，并强制换行加上 VIEW PROJECT */
    content: attr(data-title) "\A · VIEW PROJECT ·"; 
    white-space: pre; /* 允许换行 */
    
    position: absolute;
    /* --- 核心：绝对居中定位 --- */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); 
    /* ------------------------ */
    
    width: 90%; /* 防止文字太长撑破 */
    z-index: 11;
    
    /* 文字样式 */
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem; /* 字体稍微加大 */
    font-weight: 700;
    color: var(--gold-color);
    text-align: center;
    letter-spacing: 2px;
    line-height: 1.8;
    text-shadow: 0 5px 15px rgba(0,0,0,1); /* 强阴影 */
    
    /* 动画初始状态：稍微靠下一点，透明 */
    margin-top: 20px; 
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94); /* 这种动画曲线更高级 */
    pointer-events: none;
}

/* 3. 鼠标悬停状态 */
.item:hover::before {
    opacity: 1; 
}

.item:hover::after {
    opacity: 1;
    margin-top: 0; /* 上浮归位到正中心 */
}

/* 4. 图片缩放 */
.item:hover img {
    transform: scale(1.08);
    transition: all 0.8s ease; /* 变慢一点，更有呼吸感 */
    filter: blur(2px); /* 稍微加一点模糊，让中间的字更清晰 */
}