/**
 * EAZYPCB 主题自定义样式
 * 
 * @package EAZYPCB
 * @since 1.0.0
 */

/* ===== 全局样式增强 ===== */

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* ===== 首頁滾動公告欄 ===== */
.eazypcb-announcement-bar .eazypcb-announcement-inner { display: inline-flex; align-items: center; animation: none; }
.eazypcb-announcement-bar .eazypcb-announcement-item { padding: 0 2.5rem; font-size: 13px; color: #475569; white-space: nowrap; }
.eazypcb-announcement-bar.ready .eazypcb-announcement-inner {
    animation: eazypcb-announcement-scroll 18s linear infinite !important;
}
.eazypcb-announcement-bar:hover .eazypcb-announcement-inner { animation-play-state: paused; -webkit-animation-play-state: paused; }
@keyframes eazypcb-announcement-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-25%); }
}

/* ===== 動態 Banner（視頻 / 全寬）===== */
/* main 內先渲染 <script> 再插入 #dynamic-banner 時，.is-layout-flow > * + * 會給 banner 加 margin-block-start，露出白底 */
main.wp-block-group.is-layout-flow > #dynamic-banner,
.is-layout-flow > #dynamic-banner {
    margin-block-start: 0 !important;
    margin-block-end: 0 !important;
}
#dynamic-banner {
    margin-top: -2px;
    padding-top: 0;
    background-color: #000;
}
#dynamic-banner > video {
    display: block;
    margin: 0;
    padding: 0;
    vertical-align: top;
}

/* ===== 動態 Banner 文字顏色（覆蓋 theme.json 的 h1/h2 黑色） ===== */
#dynamic-banner h1,
#dynamic-banner h2,
#dynamic-banner h3,
#dynamic-banner p,
#dynamic-banner span,
#dynamic-banner .text-white,
#dynamic-banner .wp-block-heading {
    color: #fff !important;
}

/* ===== 全屏寬度強制樣式 ===== */

/* 覆蓋WordPress容器限制 - 針對HOME頁面 */
.page-template-page-home .wp-block-group {
    max-width: none !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* 全屏區域強制樣式 */
.hero-section,
.full-width-section,
section[style*="100vw"] {
    width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    margin-right: calc(-50vw + 50%) !important;
    max-width: none !important;
    box-sizing: border-box !important;
    position: relative !important;
}

/* 確保主容器不限制寬度 */
.page-template-page-home main.wp-block-group {
    max-width: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    width: 100% !important;
}

/* 覆蓋constrained布局 */
.page-template-page-home .is-layout-constrained {
    max-width: none !important;
}

/* 背景色區域全屏 */
.bg-gray-50 {
    width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    margin-right: calc(-50vw + 50%) !important;
    max-width: none !important;
}

/* 容器优化 */
.wp-block-group.is-layout-constrained > * {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== 按钮样式增强 ===== */

/* 主要按钮 */
.wp-block-button__link {
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.wp-block-button__link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* 渐变按钮 */
.eazypcb-gradient-button {
    background: linear-gradient(135deg, var(--wp--preset--color--primary) 0%, var(--wp--preset--color--secondary) 100%);
    border: none;
    color: white;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
}

.eazypcb-gradient-button:hover {
    background: linear-gradient(135deg, var(--wp--preset--color--secondary) 0%, var(--wp--preset--color--dark-green) 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(46, 204, 113, 0.3);
}

/* ===== 卡片样式 ===== */

.eazypcb-card {
    background: white;
    border: 1px solid var(--wp--preset--color--gray-light);
    border-radius: 12px;
    padding: 2rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.eazypcb-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
    border-color: var(--wp--preset--color--primary);
}

/* ===== 导航样式增强 ===== */

.wp-block-navigation-link {
    position: relative;
}

.wp-block-navigation-link a:hover {
    color: var(--wp--preset--color--primary);
}

.wp-block-navigation-link a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--wp--preset--color--primary);
    transition: width 0.3s ease;
}

.wp-block-navigation-link a:hover::after {
    width: 100%;
}

/* ===== Hero区域特效 ===== */

.hero-section {
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(27, 94, 63, 0.9) 0%, rgba(46, 204, 113, 0.8) 100%);
    z-index: 1;
}

.hero-section .wp-block-cover__inner-container {
    position: relative;
    z-index: 2;
}

/* ===== 特色图标 ===== */

.eazypcb-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--wp--preset--color--primary) 0%, var(--wp--preset--color--secondary) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    margin-bottom: 1rem;
}

/* ===== 统计数字 ===== */

.eazypcb-stats {
    text-align: center;
}

.eazypcb-stats-number {
    font-size: 3rem;
    font-weight: 700;
    color: var(--wp--preset--color--primary);
    line-height: 1;
    display: block;
}

.eazypcb-stats-label {
    font-size: 0.9rem;
    color: var(--wp--preset--color--gray-medium);
    margin-top: 0.5rem;
}

/* ===== 时间轴样式 ===== */

.eazypcb-timeline {
    position: relative;
    padding-left: 2rem;
}

.eazypcb-timeline::before {
    content: '';
    position: absolute;
    left: 1rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--wp--preset--color--primary);
}

.eazypcb-timeline-item {
    position: relative;
    margin-bottom: 2rem;
}

.eazypcb-timeline-item::before {
    content: '';
    position: absolute;
    left: -1.75rem;
    top: 0.5rem;
    width: 12px;
    height: 12px;
    background: var(--wp--preset--color--primary);
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 0 0 3px var(--wp--preset--color--primary);
}

/* ===== 联系表单样式 ===== */

.eazypcb-contact-form input,
.eazypcb-contact-form textarea,
.eazypcb-contact-form select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--wp--preset--color--gray-light);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.eazypcb-contact-form input:focus,
.eazypcb-contact-form textarea:focus,
.eazypcb-contact-form select:focus {
    outline: none;
    border-color: var(--wp--preset--color--primary);
    box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.1);
}

/* ===== 产品网格 ===== */

.eazypcb-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.eazypcb-product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.eazypcb-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.eazypcb-product-image {
    aspect-ratio: 16/9;
    overflow: hidden;
}

.eazypcb-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.eazypcb-product-card:hover .eazypcb-product-image img {
    transform: scale(1.05);
}

/* ===== 客户证言 ===== */

.eazypcb-testimonial {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    position: relative;
}

.eazypcb-testimonial::before {
    content: '"';
    font-size: 4rem;
    color: var(--wp--preset--color--primary);
    position: absolute;
    top: -1rem;
    left: 1rem;
    line-height: 1;
}

.eazypcb-testimonial-content {
    font-style: italic;
    margin-bottom: 1rem;
    color: var(--wp--preset--color--gray-dark);
}

.eazypcb-testimonial-author {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.eazypcb-testimonial-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--wp--preset--color--gray-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--wp--preset--color--primary);
}

/* ===== 响应式优化 ===== */

@media (max-width: 768px) {
    .wp-block-columns {
        flex-direction: column;
    }
    
    .eazypcb-product-grid {
        grid-template-columns: 1fr;
    }
    
    .hero-section h1 {
        font-size: 2.5rem !important;
    }
    
    .wp-block-cover {
        min-height: 400px !important;
    }
    
    .eazypcb-card {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .hero-section h1 {
        font-size: 2rem !important;
    }
    
    .eazypcb-stats-number {
        font-size: 2rem;
    }
    
    .eazypcb-card {
        padding: 1rem;
    }
}

/* ===== 加载动画 ===== */

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

.eazypcb-fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* ===== 滚动显示动画 ===== */

.eazypcb-scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease-out;
}

.eazypcb-scroll-reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== 自定义工具类 ===== */

.eazypcb-text-gradient {
    background: linear-gradient(135deg, var(--wp--preset--color--primary) 0%, var(--wp--preset--color--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.eazypcb-border-gradient {
    border: 2px solid transparent;
    background-image: linear-gradient(white, white), linear-gradient(135deg, var(--wp--preset--color--primary) 0%, var(--wp--preset--color--secondary) 100%);
    background-origin: border-box;
    background-clip: content-box, border-box;
}

/* ===== 新聞列表頁：消除導航與 teal Hero 之間白縫（block gap / main 頂部 padding） ===== */
body:has(.news-page-hero) .wp-site-blocks {
    padding-top: 0 !important;
    margin-top: 0 !important;
}
body:has(.news-page-hero) main.wp-block-group {
    padding-top: 0 !important;
    margin-top: 0 !important;
}
body:has(.news-page-hero) .wp-block-post-content {
    margin-block-start: 0 !important;
    padding-top: 0 !important;
}
body:has(.news-page-hero) .wp-block-post-content > *:first-child {
    margin-block-start: 0 !important;
}
body:has(.news-page-hero) .news-page-hero {
    margin-top: 0 !important;
}

/* ===== 首頁合作品牌 Logo 輪播（後台：外觀 → 合作品牌 Logo）===== */
.eazypcb-partner-logos-section {
    border-top: 1px solid rgba(226, 232, 240, 0.9);
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}

.eazypcb-partner-logos-viewport {
    overflow: hidden;
    mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}

.eazypcb-partner-logos-track {
    display: inline-flex;
    align-items: center;
    gap: 2.5rem;
    width: max-content;
    animation: eazypcb-partner-marquee 50s linear infinite;
}

@media (max-width: 639px) {
    .eazypcb-partner-logos-track {
        gap: 1.75rem;
        animation-duration: 42s;
    }
}

@media (prefers-reduced-motion: reduce) {
    .eazypcb-partner-logos-track {
        animation: none;
    }

    .eazypcb-partner-logos-viewport {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        mask-image: none;
        -webkit-mask-image: none;
    }

    .eazypcb-partner-logos-track {
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }
}

.eazypcb-partner-logos-root--ready:hover .eazypcb-partner-logos-track {
    animation-play-state: paused;
}

.eazypcb-partner-logos-item {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 56px;
    width: 132px;
    padding: 0 0.35rem;
}

.eazypcb-partner-logos-item img {
    max-height: 44px;
    max-width: 118px;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: grayscale(1);
    opacity: 0.78;
    transition: filter 0.28s ease, opacity 0.28s ease;
}

.eazypcb-partner-logos-item:hover img {
    filter: grayscale(0);
    opacity: 1;
}

@keyframes eazypcb-partner-marquee {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

/* ===== 打印样式 ===== */

@media print {
    .wp-block-navigation,
    .wp-block-button,
    .eazypcb-gradient-button {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
        color: black;
    }
    
    h1, h2, h3, h4, h5, h6 {
        color: black;
    }
}