/************************************
 * 1. 基礎設定與變數 (Global Settings)
 *
 * 設計語彙：延續 Logo 的深藍主調，
 * 搭配工程製圖常見的「藍圖 / 圖紙」語感 —
 * 方格底紋、十字對位記號、圖號標籤、
 * 等高線式的細節，呼應「3D 列印 + 工程製圖」的品牌本質。
 ************************************/

:root {
    /* 主色調：呼應 Logo 的深藍 */
    --navy-deep: #132840;
    --navy-darker: #0b1a2b;
    --navy-soft: #2a3f58;

    /* 輔色：黃銅色 — 精密儀器與圖紙標註常見的暖色點綴 */
    --brass: #b8862c;
    --brass-light: #d9a94f;

    /* 中性色 */
    --cream: #f6f4ee;
    --paper: #ffffff;
    --ink: #232b35;
    --ink-soft: #5b6572;
    --line-soft: rgba(19, 40, 64, 0.14);
    --shadow-color: rgba(19, 40, 64, 0.12);

    /* 字體 */
    --font-display: 'Noto Serif TC', 'Times New Roman', serif;
    --font-body: 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
    --font-mono: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* 網頁基礎設定 */
body {
    font-family: var(--font-body);
    margin: 0;
    padding: 0;
    line-height: 1.75;
    color: var(--ink);
    background-color: var(--cream);
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    body {
        scroll-behavior: auto;
    }

    * {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}

/* 標題 H2 樣式 */
h2 {
    font-family: var(--font-display);
    color: var(--navy-deep);
    text-align: center;
    margin-bottom: 12px;
    font-size: 2.2em;
    font-weight: 700;
    letter-spacing: 1px;
}

/* 每個區塊標題上方的圖紙式標籤（eyebrow） */
.section-eyebrow {
    display: block;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.78em;
    letter-spacing: 3px;
    color: var(--brass);
    margin-bottom: 14px;
    text-transform: uppercase;
}

.section-lede {
    text-align: center;
    max-width: 640px;
    margin: 0 auto 40px;
    color: var(--ink-soft);
}

/* 鍵盤可視焦點（無障礙基本門檻） */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--brass);
    outline-offset: 3px;
}

/************************************
 * 2. 頁首與導航 (Header & Navigation)
 ************************************/

header {
    background: var(--paper);
    padding: 14px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px var(--shadow-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.logo-img {
    height: 38px;
    width: auto;
    border-radius: 6px;
    transition: opacity 0.3s;
}

.logo-wordmark {
    font-family: var(--font-display);
    font-size: 1.15em;
    font-weight: 700;
    color: var(--navy-deep);
    letter-spacing: 0.5px;
}

.logo-wordmark small {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.5em;
    font-weight: 400;
    letter-spacing: 2px;
    color: var(--ink-soft);
    text-transform: uppercase;
}

.logo:hover .logo-img {
    opacity: 0.8;
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}

nav ul li a {
    text-decoration: none;
    color: var(--ink);
    padding: 0.5em 1.2em;
    display: block;
    font-weight: 500;
    position: relative;
    transition: color 0.2s ease-out;
}

nav ul li a:hover {
    color: var(--navy-deep);
}

nav ul li a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background-color: var(--brass);
    transition: width 0.2s ease-out, left 0.2s ease-out;
}

nav ul li a:hover::after {
    width: 100%;
    left: 0;
}

/* 漢堡選單按鈕 */
.menu-toggle {
    font-size: 1.6em;
    line-height: 1;
    cursor: pointer;
    display: none;
    background: none;
    border: none;
    color: var(--navy-deep);
    z-index: 1001;
    padding: 6px 10px;
}

/************************************
 * 3. 區塊樣式 (Sections)
 ************************************/

section {
    padding: 90px 10%;
}

.dark-section {
    background-color: var(--navy-deep);
    color: var(--cream);
}

.dark-section h2 {
    color: var(--paper);
}

.dark-section .section-lede {
    color: rgba(246, 244, 238, 0.75);
}

/* --------------------
 * Hero — 藍圖底紋 + 對位記號
 * -------------------- */

#hero {
    position: relative;
    text-align: center;
    color: var(--paper);
    padding: 130px 10%;
    background-color: var(--navy-darker);
    background-image:
        linear-gradient(rgba(11, 26, 43, 0.88), rgba(11, 26, 43, 0.88)),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.06) 0, rgba(255, 255, 255, 0.06) 1px, transparent 1px, transparent 32px),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0, rgba(255, 255, 255, 0.06) 1px, transparent 1px, transparent 32px);
    overflow: hidden;
}

#hero::before,
#hero::after,
.hero-corner-tl,
.hero-corner-br {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border-color: var(--brass-light);
}

#hero::before {
    top: 24px;
    left: 24px;
    border-top: 2px solid var(--brass-light);
    border-left: 2px solid var(--brass-light);
}

#hero::after {
    top: 24px;
    right: 24px;
    border-top: 2px solid var(--brass-light);
    border-right: 2px solid var(--brass-light);
}

.hero-corner-bl {
    position: absolute;
    bottom: 24px;
    left: 24px;
    width: 22px;
    height: 22px;
    border-bottom: 2px solid var(--brass-light);
    border-left: 2px solid var(--brass-light);
}

.hero-corner-br {
    bottom: 24px;
    right: 24px;
    border-bottom: 2px solid var(--brass-light);
    border-right: 2px solid var(--brass-light);
}

.hero-eyebrow {
    position: relative;
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.8em;
    letter-spacing: 4px;
    color: var(--brass-light);
    text-transform: uppercase;
    margin-bottom: 22px;
}

#hero h1 {
    position: relative;
    font-family: var(--font-display);
    font-size: 2.6em;
    line-height: 1.4;
    margin: 0 0 0.4em;
    max-width: 16ch;
    margin-left: auto;
    margin-right: auto;
}

#hero p {
    position: relative;
    font-size: 1.15em;
    color: rgba(246, 244, 238, 0.85);
}

/************************************
 * 4. 互動元素 (CTA Buttons)
 ************************************/

.cta-button {
    display: inline-block;
    background-color: var(--brass);
    color: var(--navy-darker);
    text-decoration: none;
    padding: 12px 28px;
    border-radius: 4px;
    margin-top: 24px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border: 1px solid var(--brass);
    transition: background-color 0.25s, transform 0.15s, color 0.25s;
}

.cta-button:hover {
    background-color: transparent;
    color: var(--brass-light);
    transform: translateY(-2px);
}

/* 關於我們 */
#about .info-block {
    max-width: 640px;
    margin: 0 auto;
    text-align: center;
}

#about address {
    font-style: normal;
    color: var(--ink-soft);
}

/************************************
 * 5. 規格化服務與商品區塊 (#products)
 ************************************/

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 28px;
    max-width: 1100px;
    margin: 0 auto;
}

.product-card {
    background-color: var(--paper);
    border: 1px solid var(--line-soft);
    padding: 28px;
    border-radius: 6px;
    box-shadow: 0 6px 18px var(--shadow-color);
    text-align: left;
}

.product-sku {
    font-family: var(--font-mono);
    font-size: 0.75em;
    color: var(--brass);
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.product-desc {
    font-size: 0.92em;
    color: var(--ink-soft);
    margin-bottom: 20px;
}

.product-spec-table {
    margin: 16px 0;
    font-size: 0.88em;
}

.spec-row {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px dashed var(--line-soft);
    padding: 6px 0;
    color: var(--ink);
}

.product-price {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--navy-deep);
    margin-top: 20px;
    border-top: 1px solid var(--line-soft);
    padding-top: 14px;
}

.product-price small {
    font-size: 0.6em;
    font-weight: 400;
    color: var(--ink-soft);
}

/************************************
 * 6. 作品集 — 圖紙卡片 (Spec Sheet Cards)
 ************************************/

#works {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 28px;
    max-width: 1100px;
    margin: 0 auto;
}

#works>.section-eyebrow,
#works>h2,
#works>.section-lede {
    grid-column: 1 / -1;
}

.work-item {
    position: relative;
    background-color: var(--paper);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 22px 22px 26px;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    color: var(--ink);
    text-align: left;
    transition: transform 0.3s, box-shadow 0.3s;
    opacity: 0;
    transform: translateY(16px);
}

.work-item.in-view {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.work-item:hover {
    transform: translateY(-6px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.3);
}

.work-item .drawing-tag {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.72em;
    letter-spacing: 1px;
    color: var(--brass);
    border: 1px dashed var(--brass);
    padding: 3px 8px;
    border-radius: 3px;
    margin-bottom: 14px;
}

.work-item .work-image-container {
    margin: 0 0 16px;
    overflow: hidden;
    border-radius: 5px;
    border: 1px solid var(--line-soft);
}

.work-item .work-image {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.5s ease;
}

.work-item:hover .work-image {
    transform: scale(1.04);
}

.work-item h3 {
    font-family: var(--font-display);
    color: var(--navy-deep);
    margin: 0 0 8px;
}

.work-item .specs {
    font-family: var(--font-mono);
    font-size: 0.85em;
    color: var(--ink-soft);
    background: var(--cream);
    display: inline-block;
    padding: 6px 10px;
    border-radius: 4px;
    margin-top: 10px;
}

.work-item .notes {
    font-size: 0.9em;
    color: var(--ink-soft);
}

/************************************
 * 7. 聯絡頁面與詢價表單
 ************************************/

.contact-section {
    text-align: center;
    padding: 100px 10%;
}

.main-title {
    font-family: var(--font-display);
    margin-bottom: 0;
    font-size: 2.8em;
    color: var(--navy-deep);
}

.subtitle {
    font-family: var(--font-mono);
    font-size: 1em;
    letter-spacing: 2px;
    margin-top: 6px;
    margin-bottom: 30px;
    color: var(--brass);
    text-transform: uppercase;
}

#contact-page .info-block {
    max-width: 560px;
    margin: 0 auto;
}

.operating-hours,
.address {
    font-weight: 700;
    font-size: 1.05em;
    margin-top: 24px;
    margin-bottom: 10px;
    color: var(--navy-deep);
}

.contact-details {
    margin-top: 30px;
}

.contact-details p {
    margin-bottom: 10px;
    font-size: 1.05em;
}

.contact-details a {
    color: var(--navy-deep);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid var(--brass);
}

.contact-details a:hover {
    color: var(--brass);
}

.secondary-cta {
    background-color: transparent !important;
    color: var(--navy-deep) !important;
    border: 1px solid var(--navy-deep) !important;
    margin-top: 50px;
}

.secondary-cta:hover {
    background-color: var(--navy-deep) !important;
    color: var(--paper) !important;
}

/* 表單容器 */
.form-container {
    width: 60%;
    margin: 40px auto;
    padding: 32px;
    background-color: var(--paper);
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(19, 40, 64, 0.08);
    text-align: left;
}

.form-container h3 {
    font-family: var(--font-display);
    text-align: center;
    color: var(--navy-deep);
    margin-top: 0;
    margin-bottom: 28px;
}

.contact-form label {
    display: block;
    margin-bottom: 8px;
    margin-top: 15px;
    font-weight: 700;
    color: var(--ink);
}

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form input[type="file"],
.contact-form textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    font-family: var(--font-body);
    transition: border-color 0.3s, box-shadow 0.3s;
    background-color: var(--paper);
}

.contact-form input[type="file"] {
    padding: 8px 12px;
    background: #fdfdfd;
    cursor: pointer;
}

.contact-form input:focus,
.contact-form textarea:focus {
    border-color: var(--navy-deep);
    box-shadow: 0 0 0 3px rgba(19, 40, 64, 0.12);
    outline: none;
}

.contact-form textarea {
    resize: vertical;
}

.required {
    color: var(--brass);
    margin-left: 4px;
}

.contact-form .cta-button {
    width: 100%;
    margin-top: 10px;
    text-align: center;
    cursor: pointer;
    font-size: 1em;
}

/* 服務類型：大按鈕設計 */
.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 22px;
}

.radio-group input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.radio-group label {
    margin: 0;
    padding: 12px 20px;
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    font-weight: 500;
    color: var(--ink-soft);
    cursor: pointer;
    transition: all 0.2s;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.radio-group input[type="radio"]:checked+label {
    background: var(--navy-deep);
    border-color: var(--navy-deep);
    color: var(--paper);
}

.radio-group input[type="radio"]:focus-visible+label {
    outline: 2px solid var(--brass);
    outline-offset: 2px;
}

/************************************
 * 8. 社群一體化懸浮快聯區 (Floating Action Bar)
 ************************************/

.floating-action-bar {
    position: fixed;
    right: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 2000;
}

/* 基礎小圓框通用樣式 */
.floating-circle {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(19, 40, 64, 0.25);
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.25s, border-color 0.25s;
    background: var(--paper);
    border: 1px solid var(--line-soft);
}

.floating-circle svg {
    width: 24px;
    height: 24px;
}

.floating-circle:hover {
    transform: translateY(-4px) scale(1.08);
}

/* LINE 綠色特化 */
.circle-line {
    color: #06C755;
    border-color: rgba(6, 199, 85, 0.2);
}

.circle-line:hover {
    background: #06C755;
    color: var(--paper);
    border-color: #06C755;
}

/* IG 暖金特化 */
.circle-ig {
    color: var(--brass);
    border-color: rgba(184, 134, 44, 0.2);
}

.circle-ig:hover {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: var(--paper);
    border-color: transparent;
}

/* 電話特化 */
.circle-phone {
    font-size: 1.3em;
    background: var(--brass);
    border-color: var(--brass);
}

.circle-phone:hover {
    background: var(--brass-light);
    border-color: var(--brass-light);
}

/************************************
 * 9. 頁尾 (Footer)
 ************************************/

footer {
    background: var(--navy-darker);
    color: var(--cream);
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    padding: 30px 5%;
    font-size: 0.9em;
    min-height: 50px;
    border-top: 4px solid var(--brass);
}

footer p {
    margin: 0;
    font-weight: 300;
}

/************************************
 * 10. RWD 響應式設計
 ************************************/

@media (max-width: 768px) {

    header {
        padding: 10px 5%;
    }

    .logo-wordmark {
        font-size: 1em;
    }

    .menu-toggle {
        display: block;
    }

    nav#mainNav {
        display: none;
        position: absolute;
        top: 62px;
        left: 0;
        width: 100%;
        background: var(--paper);
        border-top: 1px solid #eee;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
        z-index: 999;
    }

    nav#mainNav.is-open {
        display: block;
    }

    nav ul {
        flex-direction: column;
        text-align: center;
        margin: 0;
        padding: 0;
    }

    nav ul li a {
        padding: 14px 0;
        border-bottom: 1px solid #f5f5f5;
    }

    section {
        padding: 50px 6%;
    }

    #hero {
        padding: 70px 6%;
    }

    #hero h1 {
        font-size: 1.7em;
        max-width: 100%;
    }

    #hero p {
        font-size: 1em;
    }

    .hero-eyebrow {
        font-size: 0.7em;
        letter-spacing: 2px;
    }

    .main-title {
        font-size: 2.1em;
    }

    .form-container {
        width: 100%;
        margin: 20px auto;
        padding: 16px;
    }

    .radio-group label {
        flex: 1 1 auto;
        justify-content: center;
        text-align: center;
    }

    .floating-action-bar {
        right: 14px;
        bottom: 14px;
        gap: 10px;
    }

    .floating-circle {
        width: 46px;
        height: 46px;
        font-size: 1.1em;
    }

    .floating-circle svg {
        width: 20px;
        height: 20px;
    }

    footer {
        justify-content: flex-start;
    }
}

@media (min-width: 769px) {
    .menu-toggle {
        display: none !important;
    }

    nav#mainNav {
        display: block !important;
        position: static !important;
        box-shadow: none !important;
        border-top: none !important;
    }

    nav ul {
        flex-direction: row;
    }
}