/* Global Styles */
:root {
    --primary-color: #0d253f;
    /* Deep Navy Blue */
    --secondary-color: #536dfe;
    /* Vibrant Blue Accent */
    --text-color: #333;
    --light-bg: #f8f9fa;
    --dark-bg: #1a1a1a;
    --white: #ffffff;
    --silver: #e0e0e0;
    --font-main: 'Noto Sans TC', sans-serif;
    --transition: all 0.3s ease;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 10px 20px rgba(0, 0, 0, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--white);
    scroll-behavior: smooth;
}

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

ul {
    list-style: none;
}

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

.container {
    max-width: 1400px;
    /* Increased from 1200px to accommodate larger header */
    margin: 0 auto;
    padding: 0 20px;
}

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

/* Typography */
h1,
h2,
h3,
h4 {
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.3;
}

h1 {
    font-size: 3rem;
}

h2 {
    font-size: 2.2rem;
}

h3 {
    font-size: 1.5rem;
}

.section-subtitle {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 3rem;
    text-align: center;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 5px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background-color: var(--secondary-color);
    color: var(--white);
}

.btn-primary:hover {
    background-color: #304ffe;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(83, 109, 254, 0.4);
}

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

.btn-secondary:hover {
    background-color: var(--primary-color);
    color: var(--white);
}

.btn-large {
    padding: 15px 40px;
    font-size: 1.1rem;
}

/* Header */
.main-header {
    background-color: var(--white);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 25px 0;
    /* Increased from 15px */
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 2.25rem;
    /* Increased from 1.5rem */
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 15px;
    /* Increased gap */
    white-space: nowrap;
    /* Prevent wrapping */
}

.logo img {
    height: 75px;
    /* Increased from 50px */
    width: auto;
}

.en-name {
    font-size: 0.6em;
    margin-left: 5px;
    font-weight: 500;
}

.main-nav ul {
    display: flex;
    gap: 40px;
    /* Increased gap */
    align-items: center;
}

.main-nav a {
    font-weight: 500;
    font-size: 1.25rem;
    /* Increased font size */
    color: var(--primary-color);
    position: relative;
    white-space: nowrap;
    /* Prevent wrapping */
}

.main-nav a:not(.cta-nav)::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 0;
    background-color: var(--secondary-color);
    transition: var(--transition);
}

.main-nav a:not(.cta-nav):hover::after {
    width: 100%;
}

.cta-nav {
    background-color: var(--primary-color);
    color: var(--white) !important;
    padding: 12px 30px;
    /* Increased padding */
    border-radius: 4px;
}

.cta-nav:hover {
    background-color: var(--secondary-color);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(rgba(13, 37, 63, 0.8), rgba(13, 37, 63, 0.7)), url('https://images.unsplash.com/photo-1565514020176-db793303c739?ixlib=rb-1.2.1&auto=format&fit=crop&w=1950&q=80');
    /* Placeholder Industrial Image */
    background-size: cover;
    background-position: center;
    height: 80vh;
    display: flex;
    align-items: center;
    color: var(--white);
    text-align: center;
}

.hero-overlay {
    width: 100%;
}

.hero-section h1 {
    font-size: 3.5rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.hero-section h2 {
    font-size: 1.5rem;
    font-weight: 300;
    margin-bottom: 40px;
    opacity: 0.9;
}

/* Advantages Section */
.advantages-section {
    padding: 80px 0;
    background-color: var(--white);
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.advantage-item {
    text-align: center;
    padding: 30px;
    border-radius: 10px;
    background: var(--white);
    box-shadow: var(--shadow);
    transition: var(--transition);
    border-top: 4px solid transparent;
}

.advantage-item:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-hover);
    border-top-color: var(--secondary-color);
}

.icon {
    display: inline-block;
    width: 60px;
    height: 60px;
    background-color: var(--light-bg);
    border-radius: 50%;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--secondary-color);
}

/* Placeholder Icons using CSS pseudo-elements or text */
.icon-cnc::before {
    content: '⚙️';
}

.icon-quality::before {
    content: '🛡️';
}

.icon-custom::before {
    content: '✏️';
}

.icon-delivery::before {
    content: '🚚';
}

/* Products Section */
.products-section {
    padding: 80px 0;
    background-color: var(--light-bg);
    text-align: center;
}

.products-section h2 {
    color: var(--primary-color);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.product-card {
    background: var(--white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    padding: 40px 30px;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    /* Ensure consistent height */
    position: relative;
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: var(--secondary-color);
    transform: scaleX(0);
    transition: var(--transition);
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

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

.product-card h3 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

/* Capability Section */
.capability-section {
    padding: 80px 0;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    align-items: center;
}

.capability-content ul {
    margin: 30px 0;
}

.capability-content li {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.icon-check {
    color: var(--secondary-color);
    margin-right: 10px;
    font-weight: bold;
}

.icon-check::before {
    content: '✓';
}

.cert-thumbnail {
    width: 100%;
    max-width: 300px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: var(--transition);
    border: 4px solid var(--white);
}

.cert-thumbnail:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-hover);
    border-color: var(--secondary-color);
}

/* Contact Section */
.contact-section {
    padding: 80px 0;
    background-color: var(--primary-color);
    color: var(--white);
}

.contact-section h2 {
    margin-bottom: 20px;
}

.contact-section p {
    margin-bottom: 30px;
    opacity: 0.9;
}

.contact-info {
    margin-top: 20px;
    font-size: 1.1rem;
    font-weight: 500;
    color: #ccc;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.line-qrcode {
    width: 100px;
    height: 100px;
    margin-top: 10px;
    border-radius: 5px;
    border: 2px solid var(--white);
}

/* Footer */
.main-footer {
    background-color: var(--dark-bg);
    color: #aaa;
    padding: 60px 0 20px;
}

.main-footer h4 {
    color: var(--white);
    margin-bottom: 20px;
}

.main-footer ul li {
    margin-bottom: 10px;
}

.main-footer a:hover {
    color: var(--secondary-color);
}

.copyright {
    text-align: center;
    margin-top: 50px;
    padding-top: 20px;
    border-top: 1px solid #333;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    .main-header {
        padding: 15px 0;
        /* Reduce padding on mobile */
    }

    .logo {
        font-size: 1.5rem;
        /* Smaller logo text */
        gap: 10px;
    }

    .logo img {
        height: 50px;
        /* Smaller logo image */
    }

    .menu-toggle {
        display: block;
        color: var(--primary-color);
    }

    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--white);
        box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
        padding: 20px 0;
    }

    .main-nav.active {
        display: block;
    }

    .main-nav ul {
        flex-direction: column;
        gap: 20px;
    }

    .hero-section h1 {
        font-size: 2rem;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
        /* Stack all grids */
    }

    .container {
        padding: 0 15px;
    }
}

/* Back to Top Button */
#backToTop {
    display: none;
    /* Hidden by default */
    position: fixed;
    bottom: 20px;
    right: 30px;
    z-index: 99;
    font-size: 18px;
    border: none;
    outline: none;
    background-color: var(--secondary-color);
    color: white;
    cursor: pointer;
    padding: 15px;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: background-color 0.3s, transform 0.3s;
    width: 50px;
    height: 50px;
    text-align: center;
    line-height: 20px;
}

#backToTop:hover {
    background-color: var(--primary-color);
    transform: translateY(-3px);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s;
}

.modal-content {
    margin: 5% auto;
    display: block;
    width: 80%;
    max-width: 800px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s;
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.close-modal:hover,
.close-modal:focus {
    color: var(--secondary-color);
    text-decoration: none;
    cursor: pointer;
}

@keyframes fadeIn {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

@keyframes zoomIn {
    from {
        transform: scale(0.8)
    }

    to {
        transform: scale(1)
    }
}

@media only screen and (max-width: 700px) {
    .modal-content {
        width: 95%;
    }
}

/* Portfolio Section */
.portfolio-section {
    padding: 80px 0;
    background-color: var(--white);
    text-align: center;
}

.portfolio-section h2 {
    color: var(--primary-color);
}

.portfolio-gallery {
    margin-top: 40px;
    grid-template-columns: repeat(3, 1fr);
}

.portfolio-item {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    height: 250px;
    /* Fixed height for consistency */
}

.portfolio-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.portfolio-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.portfolio-item:hover img {
    transform: scale(1.1);
}