/* 基礎樣式 - 恢復到原來的網站外觀 */

/* 防止 i18n 闪烁：在翻译加载完成前隐藏需要翻译的内容 */
html.i18n-loading [data-i18n],
html.i18n-loading [data-i18n-placeholder],
html.i18n-loading [data-i18n-title] {
    visibility: hidden;
}

/* 品牌「DEHE｜得禾建筑」中全角竖线前的英文标色（与 VI 红贴近） */
.brand-dehe {
    color: #dc2626;
    font-weight: inherit;
}

/* 深色气泡（如 AI 助理）上略提亮，保证可读 */
.text-gray-100 .brand-dehe,
.bg-gray-700 .brand-dehe,
.bg-gray-800 .brand-dehe {
    color: #fca5a5;
}

/* 字體設置 */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    letter-spacing: 0.02em;
    line-height: 1.6;
    color: #333333;
    background-color: #ffffff;
}

/* 首頁樣式 */
.hero-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    position: relative;
    overflow: hidden;
    padding: 4rem 0;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: #111827;
}

/* 服務卡片樣式 */
.service-card {
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 2rem;
    transition: all 0.3s ease;
    height: 100%;
    background-color: #ffffff;
}

.service-card:hover {
    border-color: #d1d5db;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.service-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

/* 按鈕樣式 */
.btn-primary {
    display: inline-block;
    background-color: #000000;
    color: white;
    text-decoration: none;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-align: center;
    padding: 0.75rem 1.5rem;
    border: 2px solid #000000;
}

.btn-primary:hover {
    background-color: #333333;
    border-color: #333333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-outline {
    display: inline-block;
    background-color: transparent;
    color: #000000;
    border: 2px solid #000000;
    text-decoration: none;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-align: center;
    padding: 0.75rem 1.5rem;
}

/* AI Services button - red border and text for emphasis */
.btn-ai-primary {
    display: inline-block;
    background-color: transparent;
    color: #dc2626;
    border: 2px solid #dc2626;
    text-decoration: none;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-align: center;
    padding: 0.75rem 1.5rem;
}

.btn-ai-primary:hover {
    background-color: #dc2626;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

.btn-outline:hover {
    background-color: #000000;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 輪播組件樣式 */
.carousel-container {
    position: relative;
    overflow: hidden;
    border-radius: 0.75rem;
    max-height: 500px;
}

.carousel-wrapper {
    display: flex;
}

.carousel-slide img {
    width: 100%;
    height: auto;
    display: block;
}

/* 輪播按鈕樣式 */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    opacity: 0.7;
    transition: all 0.3s ease;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
}

.carousel-btn:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
    background-color: rgba(0, 0, 0, 0.7);
}

.prev-btn {
    left: 1rem;
}

.next-btn {
    right: 1rem;
}

/* 指示器樣式 */
.indicator-btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.indicator-btn.active,
.indicator-btn:hover {
    background-color: #ffffff;
    transform: scale(1.2);
}

/* 案例展示網格 */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(350px, 100%), 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

@media (max-width: 768px) {
    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
}

.portfolio-item {
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    background-color: #ffffff;
}

.portfolio-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.portfolio-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
}

.portfolio-content {
    padding: 1.5rem;
}

.portfolio-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333333;
}

.portfolio-category {
    display: inline-block;
    background-color: #000000;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .portfolio-grid {
        grid-template-columns: 1fr;
    }
    
    .service-card {
        padding: 1.5rem;
    }
}

/* 動畫效果 */
.fade-in {
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 移动端菜单优化 */
#mobile-menu {
    transition: all 0.3s ease;
    max-height: 0;
    overflow: hidden;
}

#mobile-menu:not(.hidden) {
    max-height: 500px;
}

/* 按钮点击波纹效果 */
.btn-primary, .btn-outline {
    position: relative;
    overflow: hidden;
}

.btn-primary::after, .btn-outline::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:active::after, .btn-outline:active::after {
    width: 300px;
    height: 300px;
}

/* 卡片悬停效果增强 */
.card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* 加载动画 */
.loading {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

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

/* 图片懒加载占位符 */
img.lazy {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 隐藏滚动条但保持滚动功能 */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* ========== 全站动效：高级感、可访问（尊重系统减少动效） ========== */
:root {
    --dh-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --dh-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --dh-dur: 0.45s;
    --dh-dur-fast: 0.28s;
    --dh-nav-underline: #111827;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* 浅灰 hero 区：轻微流动渐变 */
.bg-gradient-light {
    background: linear-gradient(125deg, #fafafa 0%, #f0f1f4 40%, #f7f8fa 70%, #fafafa 100%);
    background-size: 220% 220%;
}

@media (prefers-reduced-motion: no-preference) {
    body.dh-play-enter .bg-gradient-light {
        animation: dh-gradient-drift 14s ease-in-out infinite;
    }
}

@keyframes dh-gradient-drift {
    0%, 100% { background-position: 0% 40%; }
    50% { background-position: 100% 60%; }
}

/* 页面主区入场（由 JS 添加 dh-play-enter，避免无 JS 时闪烁） */
@media (prefers-reduced-motion: no-preference) {
    body.dh-play-enter #site-main {
        animation: dh-page-in 0.75s var(--dh-ease-out) both;
    }
}

@keyframes dh-page-in {
    to {
        opacity: 1;
        transform: none;
        filter: none;
    }
}

/* 顶栏：滚动后毛玻璃与阴影 */
.dh-site-nav.dh-nav-scrolled {
    background-color: rgba(255, 255, 255, 0.92) !important;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

/* 桌面主导航：底边线条动效 */
.dh-nav-link {
    position: relative;
    transition: color var(--dh-dur-fast) var(--dh-ease-out);
}

.dh-nav-link::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 2px;
    background: var(--dh-nav-underline);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.4s var(--dh-ease-out);
    border-radius: 1px;
}

.dh-nav-link:hover::after,
.dh-nav-link.dh-nav-active::after {
    transform: scaleX(1);
}

.dh-nav-link.dh-nav-active {
    color: #111827;
    font-weight: 600;
}

/* 导航「智能服务」：故宫红（宫墙深红，略偏赭） */
.dh-site-nav .dh-nav-link.dh-nav-ai-hub {
    color: #9b2335;
    font-weight: 600;
}
.dh-site-nav .dh-nav-link.dh-nav-ai-hub:hover {
    color: #7a1b29;
}
.dh-site-nav .dh-nav-link.dh-nav-ai-hub.dh-nav-active {
    color: #7a1b29;
}
.dh-site-nav .dh-nav-link.dh-nav-ai-hub::after {
    background: #9b2335;
}

.dh-mobile-nav-link.dh-nav-ai-hub-mobile {
    color: #9b2335;
    font-weight: 600;
}
.dh-mobile-nav-link.dh-nav-ai-hub-mobile:hover {
    color: #7a1b29;
}
.dh-mobile-nav-link.dh-nav-ai-hub-mobile.dh-nav-active {
    border-left-color: #9b2335;
    color: #7a1b29;
    background-color: rgba(155, 35, 53, 0.06);
}

.dh-mobile-nav-link.dh-nav-active {
    border-left-color: #111827;
    background-color: rgba(17, 24, 39, 0.04);
    color: #111827;
    font-weight: 600;
}

/* 区块滚动入场 */
.dh-section-reveal {
    opacity: 0;
    transform: translateY(28px);
    transition:
        opacity 0.65s var(--dh-ease-out),
        transform 0.65s var(--dh-ease-out);
}

.dh-section-reveal.dh-section-visible {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    .dh-section-reveal {
        opacity: 1;
        transform: none;
    }
}

/* 热线按钮轻微呼吸光晕 */
@media (prefers-reduced-motion: no-preference) {
    .dh-pulse-soft {
        animation: dh-soft-glow 3.5s ease-in-out infinite;
    }
}

@keyframes dh-soft-glow {
    0%, 100% { box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2); }
    50% { box-shadow: 0 14px 32px -4px rgba(0, 0, 0, 0.28); }
}

/* 资讯/案例 统一筛选胶囊 */
.category-btn {
    transition:
        transform var(--dh-dur-fast) var(--dh-ease-out),
        box-shadow var(--dh-dur-fast) var(--dh-ease-out),
        border-color 0.25s ease,
        background-color 0.25s ease,
        color 0.25s ease;
}

.category-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.category-btn.active {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

/* 分页：圆角胶囊 + 微缩放 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.pagination .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    padding: 0.5rem 0.9rem;
    border-radius: 9999px;
    border: 1px solid #e5e7eb;
    text-decoration: none;
    color: #374151;
    font-weight: 500;
    font-size: 0.875rem;
    transition:
        transform 0.22s var(--dh-ease-spring),
        box-shadow 0.25s ease,
        background-color 0.25s ease,
        border-color 0.25s ease,
        color 0.25s ease;
    background: #fff;
}

.pagination .page-link:hover:not(.active) {
    background: #f9fafb;
    border-color: #d1d5db;
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.07);
}

.pagination .page-link:active:not(.active) {
    transform: scale(0.97);
}

.pagination .page-link.active {
    background: linear-gradient(145deg, #111827 0%, #000 100%);
    color: #fff;
    border-color: #111827;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
    cursor: default;
    transform: scale(1.02);
}

/* 案例卡片图片缩放 */
.portfolio-item .relative {
    overflow: hidden;
}

.portfolio-item .portfolio-image {
    transition: transform 0.55s var(--dh-ease-out);
}

.portfolio-item:hover .portfolio-image {
    transform: scale(1.06);
}

/* 资讯卡片图片 */
.news-card .relative img {
    transition: transform 0.55s var(--dh-ease-out);
}

.news-card:hover .relative img {
    transform: scale(1.05);
}

.news-card {
    transition:
        transform 0.35s var(--dh-ease-out),
        box-shadow 0.35s ease;
}

.news-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.12);
}

/* 主体内链接点击反馈（排除按钮类） */
main a:not([class*="btn-"]):not([class*="rounded-full"]):not(.category-btn) {
    transition: color 0.2s ease, opacity 0.2s ease;
}

@media (prefers-reduced-motion: no-preference) {
    main a:not([class*="btn-"]):not([class*="rounded-full"]):not(.category-btn):active {
        opacity: 0.85;
    }
}

/* 百度接口翻译进行中 */
html.dh-translating body {
    cursor: wait;
}

.dh-lang-switch.dh-lang-active {
    color: #111827 !important;
    font-weight: 600;
}

/* 语言切换：不依赖 Tailwind 的 md:inline-flex（当前构建未包含时会导致整块一直 display:none） */
.dh-lang-switcher-desktop {
    display: none;
}

@media (min-width: 768px) {
    .dh-lang-switcher-desktop {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        margin-left: 0.75rem;
        padding-left: 1.25rem;
        border-left: 1px solid #e5e7eb;
        flex-shrink: 0;
    }
}

.dh-lang-switcher-mobile-top {
    flex-shrink: 0;
    line-height: 1.25;
}

.dh-lang-switcher-mobile-top .dh-lang-switch {
    font-size: 0.75rem;
    letter-spacing: 0.02em;
}