/* ==========================================================================
   SENCO (欣歐) Website Stylesheet
   Modern Industrial Sleek Theme: Dark Slate (#0f1219) & Electric Orange (#ff6b00)
   ========================================================================== */

/* --- CSS Variables & Design System --- */
:root {
    --bg-main: #f5f7fb;
    --bg-card: #ffffff;
    --bg-card-hover: #f3f6fb;
    --bg-glass: rgba(255, 255, 255, 0.8);
    
    --accent: #ff6b00;
    --accent-hover: #e05e00;
    --accent-glow: rgba(255, 107, 0, 0.16);
    
    --text-primary: #111827;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --border-color: #e2e8f0;
    --border-color-hover: #cbd5e1;
    
    --font-heading: 'Outfit', 'Noto Sans TC', sans-serif;
    --font-body: 'Noto Sans TC', sans-serif;
    
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    --container-max-width: 1200px;
    --header-height: 80px;
}

/* --- Color scheme ---
   網站只設計淺色版面；明確宣告 light，避免手機/平板系統深色模式
   （或 Chrome / Samsung 瀏覽器的自動深色）把部份區塊變暗。 */
:root {
    color-scheme: only light;
}

/* --- Base & Reset --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-body);
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    line-height: 1.6;
    background-color: var(--bg-main);
    color: var(--text-primary);
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition-fast);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* --- Layout Utility Classes --- */
.container {
    width: 100%;
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 24px;
}

.section-padding {
    padding: 100px 0;
}

@media (max-width: 768px) {
    .section-padding {
        padding: 60px 0;
    }
}

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

.text-right {
    text-align: right;
}

.text-accent {
    color: var(--accent);
}

.section-title {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: 1px;
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto 50px auto;
}

@media (max-width: 768px) {
    .section-title {
        font-size: 2rem;
    }
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    font-family: var(--font-heading);
    font-weight: 600;
    border-radius: 4px;
    transition: var(--transition-normal);
    cursor: pointer;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    border: 2px solid transparent;
}

.btn-primary {
    background-color: var(--accent);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    box-shadow: 0 0 15px var(--accent-glow);
    transform: translateY(-2px);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--accent);
    color: var(--accent);
}

.btn-outline:hover {
    background-color: var(--accent);
    color: #ffffff;
    box-shadow: 0 0 15px var(--accent-glow);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    border-color: var(--text-secondary);
    background-color: rgba(15, 23, 42, 0.05);
}

/* --- Header / Navbar --- */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background-color: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: var(--transition-normal);
}

.main-header.scrolled {
    height: 70px;
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
}

.header-container {
    height: 100%;
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
}

.logo-img {
    height: 32px;
    width: auto;
    display: block;
}

.logo-text-zh {
    font-family: 'Noto Sans TC', sans-serif;
    font-weight: 700;
    font-size: 0.7rem;
    color: var(--accent);
    letter-spacing: 2px;
    margin-left: 8px;
    white-space: nowrap;
}

.footer-logo {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.navbar {
    display: flex;
    align-items: center;
}

.nav-list {
    display: flex;
    gap: 32px;
}

.nav-link {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    position: relative;
    padding: 8px 0;
}

.nav-link:hover, .nav-link.active {
    color: var(--text-primary);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: var(--accent);
    transition: width 0.3s ease, left 0.3s ease;
}

.nav-link:hover::after, .nav-link.active::after {
    width: 100%;
    left: 0;
}

.header-cta {
    display: block;
}

/* --- Hamburger Mobile Button --- */
.mobile-nav-toggle {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    flex-direction: column;
    gap: 6px;
    padding: 4px;
}

.hamburger-line {
    width: 24px;
    height: 2px;
    background-color: var(--text-primary);
    transition: var(--transition-normal);
}

/* Mobile responsive navigation styling */
@media (max-width: 900px) {
    .mobile-nav-toggle {
        display: flex;
    }
    
    .navbar {
        position: fixed;
        top: var(--header-height);
        left: -100%;
        width: 100%;
        height: calc(100vh - var(--header-height));
        background-color: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(15px);
        padding: 40px 24px;
        flex-direction: column;
        align-items: flex-start;
        transition: var(--transition-normal);
        border-top: 1px solid var(--border-color);
    }
    
    .navbar.open {
        left: 0;
    }
    
    .nav-list {
        flex-direction: column;
        width: 100%;
        gap: 24px;
    }
    
    .nav-link {
        font-size: 1.25rem;
        display: block;
        width: 100%;
    }
    
    .header-cta {
        display: none;
    }
}

/* --- Hero Section --- */
.hero-section {
    position: relative;
    padding-top: calc(var(--header-height) + 60px);
    padding-bottom: 120px;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #f8fafc 0%, #eef2f7 100%);
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -10%;
    right: -10%;
    width: 50%;
    height: 50%;
    background: radial-gradient(circle, rgba(255,107,0,0.08) 0%, transparent 70%);
    pointer-events: none;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 40px;
    align-items: center;
}

.hero-content h1 {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 24px;
    letter-spacing: 1px;
}

.hero-content h1 span {
    background: linear-gradient(90deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-desc {
    font-size: 1.15rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
    line-height: 1.8;
}

.hero-actions {
    display: flex;
    gap: 16px;
    margin-bottom: 48px;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    border-top: 1px solid var(--border-color);
    padding-top: 32px;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--accent);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.hero-image-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
}

/* Hero 區塊的產品卡片：沿用 .product-card 基礎樣式（見下方 Products Grid 區塊），
   這裡只補上寬度限制與陰影，讓它在 hero-grid 的右欄置中顯示，觀感接近原本的 hero-image-container */
.hero-product-card {
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
}

.hero-product-card:hover {
    transform: none;
}

.hero-product-card .product-img-box img {
    filter: drop-shadow(0 15px 25px rgba(15, 23, 42, 0.15));
}

/* 原始的立體配置示意圖容器：index.php 依 HERO_ISOMETRIC_CHANCE_PERCENT 機率
   偶爾顯示此版本，取代上面的 .hero-product-card */
.hero-image-container {
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1200 / 1462;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--bg-card) 0%, #f8fafc 100%);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-image-container::before {
    content: '';
    position: absolute;
    width: 150%;
    height: 150%;
    background: repeating-linear-gradient(45deg, rgba(255,107,0,0.03) 0px, rgba(255,107,0,0.03) 1px, transparent 1px, transparent 10px);
}

/* Isometric cable tray layout drawing */
.hero-svg-tray {
    width: 80%;
    height: 80%;
    object-fit: contain;
    filter: drop-shadow(0 15px 25px rgba(15, 23, 42, 0.25));
    animation: float 6s ease-in-out infinite;
}

/* --- Hero Floating Animation --- */
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

/* Premium Text Gradient for Headings */
.hero-content h1 .text-accent,
.section-title .text-accent,
.section-title.text-accent,
.home-cta-content h2 .text-accent {
    background: linear-gradient(135deg, #ff8c00 0%, #ff6b00 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

@media (max-width: 900px) {
    .hero-grid {
        grid-template-columns: 1fr;
        gap: 60px;
        text-align: center;
    }
    
    .hero-content h1 {
        font-size: 2.8rem;
    }
    
    .hero-actions {
        justify-content: center;
    }
    
    .hero-stats {
        justify-items: center;
    }
}

/* --- Features Section --- */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.feature-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 40px 30px;
    border-radius: 8px;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: var(--transition-normal);
}

.feature-card:hover {
    background-color: var(--bg-card-hover);
    transform: translateY(-8px);
    border-color: var(--accent);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08), 0 0 15px var(--accent-glow);
}

.feature-card:hover::before {
    transform: scaleX(1);
}

.feature-icon-wrapper {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    background-color: rgba(255, 107, 0, 0.1);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.feature-card h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* --- Homepage Call-to-action Section --- */
.home-cta-section {
    background: linear-gradient(135deg, #f8fafc 0%, #eef2f7 100%);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.home-cta-content {
    max-width: 700px;
    margin: 0 auto;
}

.home-cta-content h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.home-cta-content p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 35px;
}

/* --- About Us Page Layout --- */
.about-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 60px;
    align-items: start;
    margin-bottom: 100px;
}

.about-content h2 {
    font-size: 2.2rem;
    margin-bottom: 20px;
}

.about-content p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.8;
}

.about-image {
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: 0 15px 30px rgba(0,0,0,0.4);
    position: relative;
    height: 420px;
}

.about-image svg,
.about-image img {
    width: 100%;
    height: 100%;
    background-color: var(--bg-card);
    display: block;
    object-fit: contain;
}

/* --- Click-to-enlarge affordance, shared by any lightbox trigger --- */
.js-lightbox-trigger {
    cursor: pointer;
}

.js-lightbox-trigger img {
    transition: transform 0.4s ease;
}

.js-lightbox-trigger:hover img {
    transform: scale(1.03);
}

.js-lightbox-trigger::after {
    content: '\1F50D 點選檢視完整圖片';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 8px 12px;
    font-size: 0.8rem;
    color: #fff;
    background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.js-lightbox-trigger:hover::after {
    opacity: 1;
}

/* --- Image Lightbox (full-size image viewer) ---
   Selector is chained with .modal-content (instead of standing alone) so its
   specificity beats the base .modal-content rule regardless of source order,
   since both classes sit on the same element. */
.modal-content.image-lightbox-content {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    max-width: 90vw;
    width: auto;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-lightbox-content img {
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    border-radius: 8px;
    display: block;
}

/* 關閉鈕固定在視窗右上角（不放在 overflow:hidden 的框外，以免被裁掉），
   深色圓底白色 ×，手機上也看得到、點得到。 */
.image-lightbox-content .modal-close {
    position: fixed;
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.75);
    color: #fff;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2001;
}

.image-lightbox-content .modal-close:hover {
    color: #fff;
    background: var(--accent);
}

/* 放大圖本身點一下也可關閉 */
.image-lightbox-content img {
    cursor: zoom-out;
}

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

/* 關於我們：符合國際與國家雙重標準（平板改上下排列，手機再把四項標準改為單欄） */
.about-standards {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 40px;
    margin-bottom: 100px;
}

.about-standards-grid {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr;
    gap: 40px;
    align-items: center;
}

.about-standards h3 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.about-standards-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 900px) {
    .about-standards-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

@media (max-width: 560px) {
    .about-standards {
        padding: 24px 20px;
        margin-bottom: 60px;
    }

    .about-standards h3 {
        font-size: 1.45rem;
    }

    .about-standards-list {
        grid-template-columns: 1fr;
    }
}

/* --- Products Page Layout --- */
.products-wrapper {
    padding-top: calc(var(--header-height) + 40px);
    padding-bottom: 100px;
}

.products-filter-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 24px;
}

.search-select-wrapper {
    position: relative;
    display: flex;
    gap: 10px;
    max-width: 440px;
    width: 100%;
}

.search-input {
    flex: 1 1 auto;
    width: 100%;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 4px;
    outline: none;
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: var(--transition-fast);
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

.filter-clear-btn {
    flex-shrink: 0;
    padding: 12px 18px;
    font-size: 0.9rem;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

.product-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: var(--transition-normal);
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08), 0 0 15px var(--accent-glow);
}

.product-img-box {
    aspect-ratio: 4 / 3;
    background-color: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.product-svg-model {
    width: 70%;
    height: 70%;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.product-detail-gallery {
    display: grid;
    gap: 20px;
}

.product-detail-main {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 420px;
}

.product-detail-main img {
    width: 100%;
    max-height: 560px;
    object-fit: contain;
    border-radius: 8px;
}

.product-detail-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.product-detail-thumb {
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.product-detail-thumb:hover,
.product-detail-thumb.active {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.product-detail-thumb img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}

.product-info {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* 卡片內類別/品名前的小圖示，兩處共用同一尺寸與對齊方式 */
.field-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 2px;
}

.product-category-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.product-category {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    color: var(--accent);
    min-width: 0;
}

.product-category-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.product-category-zh {
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
}

.product-category-en {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* 分類非空的型錄下載按鈕，只在該分類設定了 catalog_path 時才會被渲染出來 */
.catalog-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 3px 9px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: var(--transition-fast);
}

.catalog-download-btn svg {
    width: 12px;
    height: 12px;
}

.catalog-download-btn:hover {
    background-color: var(--accent);
    color: #fff;
}

.product-title {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 12px;
}

.product-title-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.product-title-zh {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.3;
}

.product-title-en {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.product-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 20px;
    flex-grow: 1;
}

.product-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.tag {
    background-color: rgba(255, 107, 0, 0.08);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 2px;
}

/* --- Product Detail Modal --- */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(248, 250, 252, 0.9);
    backdrop-filter: blur(8px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal.open {
    display: flex;
}

.modal-content {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding: 40px;
    box-shadow: 0 25px 50px rgba(15, 23, 42, 0.12);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    transition: var(--transition-fast);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

@media (max-width: 768px) {
    .modal-grid {
        grid-template-columns: 1fr;
    }
    .modal-content {
        padding: 24px;
    }
}

.modal-media-col {
    display: flex;
    flex-direction: column;
}

.modal-img-box {
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.modal-img-box img {
    max-width: 100%;
    max-height: 100%;
}

.modal-dim-box {
    height: 200px;
}

.modal-dim-box img {
    padding: 12px;
}

.modal-media-caption {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 6px 0 16px;
}

.modal-info h2 {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}

.modal-title-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

/* 品名的中英文字大小與「產品櫥窗」卡片上的 .product-title-zh/en 一致 */
.modal-title-zh {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.3;
}

.modal-title-en {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.modal-cat-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 20px;
}

.modal-cat {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: var(--accent);
    min-width: 0;
}

.modal-cat-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

/* 分類的中英文字大小與「產品櫥窗」卡片上的 .product-category-zh/en 一致 */
.modal-cat-zh {
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
}

.modal-cat-en {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.modal-desc {
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.7;
}

.modal-spec-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 12px;
    background-color: rgba(255, 107, 0, 0.08);
    padding: 6px 10px;
    border-radius: 4px;
}

.modal-spec-title .field-icon {
    margin-top: 0;
    color: var(--accent);
}

.modal-specs-list {
    margin-bottom: 30px;
}

.modal-specs-list li {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.modal-specs-list li span:first-child {
    color: var(--text-secondary);
}

.spec-dim-table-wrap {
    margin-bottom: 30px;
    overflow-x: auto;
}

.spec-dim-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
}

.spec-dim-table th,
.spec-dim-table td {
    border-left: 1px solid var(--border-color);
    padding: 3px 10px;
}

.spec-dim-table th:first-child,
.spec-dim-table td:first-child {
    border-left: none;
}

.spec-dim-table th {
    background-color: var(--bg-card-hover);
    color: var(--text-secondary);
    font-weight: 600;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

/* 高度/長度/半徑等欄位只在第一列標示、其餘欄位沿用（rowspan 合併成一格，
   見 render_spec_table_html()），對齊方式用 top，讓數值貼齊第一列，
   不會因為合併格很高而被置中到看不到的位置；也不畫格線，避免誤讀成每列都是獨立數值。
   「寬度」欄位（W / W1 / W2）每一列都是不同數值，仍需要列間隔線才能分辨；
   其中分組主欄（如 W1）合併後的儲存格範圍較短，置中顯示較好讀 */
.spec-dim-table td {
    text-align: right;
    vertical-align: top;
}

.spec-dim-table td.col-width {
    border-bottom: 1px solid var(--border-color);
}

.spec-dim-table td.col-width-primary {
    vertical-align: middle;
}

/* --- Technical Page & Calculator --- */
.tech-container {
    padding-top: calc(var(--header-height) + 40px);
    padding-bottom: 100px;
}

.tech-grid {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 40px;
}

@media (max-width: 900px) {
    .tech-grid {
        grid-template-columns: 1fr;
    }
}

.tech-menu {
    position: sticky;
    top: calc(var(--header-height) + 20px);
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 24px;
}

.tech-menu-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.tech-menu-list li {
    margin-bottom: 12px;
}

.tech-menu-link {
    color: var(--text-secondary);
    font-size: 0.95rem;
    display: block;
    padding: 6px 0;
}

.tech-menu-link:hover, .tech-menu-link.active {
    color: var(--accent);
    padding-left: 4px;
}

.tech-section {
    margin-bottom: 60px;
    scroll-margin-top: calc(var(--header-height) + 20px);
}

.tech-section h2 {
    font-size: 2rem;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.tech-section h3 {
    font-size: 1.3rem;
    margin: 30px 0 16px 0;
    color: var(--text-primary);
}

.tech-section p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.8;
}

/* Technical Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    margin: 24px 0;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.tech-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.tech-table th, .tech-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
}

.tech-table th {
    background-color: var(--bg-card-hover);
    color: var(--text-primary);
    font-weight: 600;
}

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

/* Load-grade tables (.tech-table--grid) opt out of this generic hover and use
   their own scoped, row-specific hover style defined below instead. */
.tech-table:not(.tech-table--grid) tr:hover td {
    background-color: rgba(255,255,255,0.02);
}

.tech-table-subhead td {
    background-color: var(--border-color-hover);
    color: var(--text-primary);
    font-weight: 600;
}

/* Row-label cells holding bold text: darker fill so they stand out from the data columns.
   Selector includes the element type so it reliably outweighs .tech-table th/td. */
.tech-table th.tech-table-label,
.tech-table td.tech-table-label {
    background-color: var(--border-color-hover);
}

/* Load-grade tables: hover highlight covers every white-background data row (安全荷重 /
   測試荷重 rows and the 測試總荷重 span rows) — but never the bold label cells within them,
   nor the caption/header/subhead rows, which keep their fixed background regardless of the mouse. */
.tech-table--grid tr.tech-table-active-row:hover td:not(.tech-table-label) {
    background-color: #fef3c7;
}

/* Standard load-grade tables: standard name banner + clearer full grid lines */
.tech-table-caption th {
    background-color: var(--text-primary);
    color: #ffffff;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 1px;
    padding: 12px 18px;
}

.tech-table--grid {
    border-collapse: collapse;
}

.tech-table--grid th,
.tech-table--grid td {
    border: 1px solid var(--border-color-hover);
}

.tech-table--grid .tech-table-caption th {
    border-color: var(--text-primary);
}

/* Clickable A/B/C total-load cells inside the highlighted span rows: click to
   box-select, then move the selection with the arrow keys. */
.tech-table-cell {
    cursor: pointer;
}

.tech-table-cell:focus {
    outline: none;
}

.tech-table-cell.is-selected {
    box-shadow: inset 0 0 0 2px var(--accent);
}

/* NEMA Load Calculator Card */
.calculator-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, #f8fafc 100%);
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 30px;
    margin: 40px 0;
    box-shadow: 0 10px 30px var(--accent-glow);
}

.calc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

@media (max-width: 600px) {
    .calc-grid {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.select-control, .input-control {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px;
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition-fast);
}

.select-control:focus, .input-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

.calc-result-box {
    background-color: rgba(0,0,0,0.2);
    border: 1px dashed var(--border-color);
    border-radius: 6px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.calc-result-val {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--accent);
    margin: 8px 0;
}

.calc-result-lbl {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Simply Supported Beam Reference Diagrams */
.beam-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin: 24px 0;
}

.beam-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 24px;
}

.beam-diagram {
    background-color: var(--bg-card-hover);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 20px;
}

.beam-diagram svg {
    width: 100%;
    height: auto;
    display: block;
}

.beam-formula-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.beam-formula-list li {
    padding: 10px 0;
    border-bottom: 1px dashed var(--border-color);
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.beam-formula-list li:last-child {
    border-bottom: none;
}

/* FAQ Accordion */
.faq-accordion {
    margin-top: 30px;
}

.faq-item {
    border-bottom: 1px solid var(--border-color);
    padding: 16px 0;
}

.faq-question {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0, 1, 0, 1);
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-top: 8px;
}

.faq-item.open .faq-answer {
    max-height: 1000px;
    transition: max-height 0.3s cubic-bezier(1, 0, 1, 0);
}

.faq-icon {
    font-size: 1.3rem;
    color: var(--accent);
    transition: var(--transition-fast);
}

.faq-item.open .faq-icon {
    transform: rotate(45deg);
}

/* --- Contact Page Layout --- */
.contact-wrapper {
    padding-top: calc(var(--header-height) + 40px);
    padding-bottom: 100px;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 60px;
    align-items: flex-start;
}

@media (max-width: 900px) {
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
}

.contact-info-panel h2 {
    font-size: 2.2rem;
    margin-bottom: 16px;
}

.contact-info-panel > p {
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.contact-detail-list {
    margin-bottom: 40px;
}

.contact-detail-item {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

.contact-detail-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: rgba(255, 107, 0, 0.1);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.contact-detail-content h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.contact-detail-content p, .contact-detail-content a {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.map-container {
    width: 100%;
    height: 250px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.contact-form-panel {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 40px;
    box-shadow: 0 15px 35px rgba(15, 23, 42, 0.08);
}

@media (max-width: 480px) {
    .contact-form-panel {
        padding: 24px;
    }
}

.contact-form-panel h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.contact-form-panel > p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 30px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

.textarea-control {
    width: 100%;
    height: 120px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px;
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    resize: none;
    transition: var(--transition-fast);
}

.textarea-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

/* Honeypot field — kept in the DOM for bots, hidden from real users */
.form-hp {
    position: absolute !important;
    left: -9999px !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.submit-alert {
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    display: none;
}

.submit-alert.success {
    display: block;
    background-color: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid #10b981;
}

.submit-alert.error {
    display: block;
    background-color: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid #ef4444;
}

/* --- Footer Section --- */
.main-footer {
    background-color: #f8fafc;
    border-top: 1px solid var(--border-color);
    padding: 80px 0 0 0;
    color: var(--text-secondary);
    margin-top: auto;
}

.footer-container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 24px 60px 24px;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr 0.8fr 1.2fr;
    gap: 40px;
}

@media (max-width: 900px) {
    .footer-container {
        grid-template-columns: 1fr 1fr;
        gap: 50px;
    }
}

@media (max-width: 480px) {
    .footer-container {
        grid-template-columns: 1fr;
    }
}

.footer-block {
    display: flex;
    flex-direction: column;
}

.footer-title {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 24px;
    position: relative;
    padding-bottom: 8px;
}

.footer-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 30px;
    height: 2px;
    background-color: var(--accent);
}

.footer-desc {
    font-size: 0.9rem;
    line-height: 1.7;
    margin-top: 20px;
    margin-bottom: 24px;
}

.footer-socials {
    display: flex;
    gap: 12px;
}

.social-icon-link {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.social-icon-link:hover {
    background-color: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
    transform: translateY(-3px);
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    font-size: 0.9rem;
}

.footer-links a:hover {
    color: var(--text-primary);
    padding-left: 4px;
}

.footer-contact-info li {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    align-items: flex-start;
}

.contact-icon {
    width: 18px;
    height: 18px;
    color: var(--accent);
    flex-shrink: 0;
    margin-top: 2px;
}

.footer-bottom {
    border-top: 1px solid var(--border-color);
    padding: 30px 0;
    font-size: 0.8rem;
    text-align: center;
    background-color: #eef2f7;
}

.bottom-container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* --- Accessibility sr-only Class --- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================
   Project Gallery (工程實績 - Engineering References)
   ========================================== */
.project-gallery-main-wrap {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 340px;
    overflow: hidden;
}

.project-gallery-main-wrap img {
    width: 100%;
    max-height: 480px;
    object-fit: contain;
    border-radius: 8px;
    display: block;
}

.project-gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: rgba(15, 18, 25, 0.55);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    z-index: 5;
}

.project-gallery-arrow:hover {
    background-color: var(--accent);
}

.project-gallery-arrow.prev {
    left: 16px;
}

.project-gallery-arrow.next {
    right: 16px;
}

.project-gallery-counter {
    position: absolute;
    bottom: 12px;
    right: 16px;
    background-color: rgba(15, 18, 25, 0.55);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    z-index: 5;
}

.project-gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 16px;
}

@media (max-width: 640px) {
    .project-gallery-thumbs {
        grid-template-columns: repeat(2, 1fr);
    }
}

.project-gallery-thumb {
    border: 2px solid var(--border-color);
    background: var(--bg-card);
    padding: 0;
    border-radius: 6px;
    cursor: pointer;
    overflow: hidden;
    transition: var(--transition-fast);
    line-height: 0;
}

.project-gallery-thumb:hover,
.project-gallery-thumb.active {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.project-gallery-thumb img {
    width: 100%;
    height: 130px;
    object-fit: cover;
    display: block;
}

.project-list-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 32px;
    height: 100%;
}

.project-list-card h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.project-list-card h3 .tag-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--accent);
    flex-shrink: 0;
}

.project-list {
    list-style: none;
    padding: 0;
    margin: 0;
    columns: 1;
    column-gap: 24px;
}

.project-list.two-col {
    columns: 2;
}

.project-list li {
    break-inside: avoid;
    padding: 10px 0;
    border-bottom: 1px dashed var(--border-color);
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.project-list li:last-child {
    border-bottom: none;
}

@media (max-width: 640px) {
    .project-list.two-col {
        columns: 1;
    }
}
