/* =====================================================
   PCVN Co., Ltd - Enhanced Stylesheet
   Complete CSS with proper image loading effects
   ===================================================== */

/* ===== CSS Variables (Design Tokens) ===== */
:root {
    /* Colors - Using a professional palette */
    --color-primary: #1a1a1a;        /* Deep black for main text */
    --color-secondary: #757575;      /* Gray for secondary text */
    --color-accent: #0056b3;         /* Professional blue for CTAs */
    --color-accent-hover: #003d82;   /* Darker blue on hover */
    --color-background: #ffffff;     /* Clean white background */
    --color-surface: #f8f9fa;        /* Light gray for sections */
    --color-border: #e5e5e5;         /* Subtle borders */

    /* Typography - Using Inter for modern, clean look */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Font Sizes - Establishing hierarchy */
    --text-xs: 0.75rem;      /* 12px */
    --text-sm: 0.875rem;     /* 14px */
    --text-base: 1rem;       /* 16px */
    --text-lg: 1.125rem;     /* 18px */
    --text-xl: 1.25rem;      /* 20px */
    --text-2xl: 1.5rem;      /* 24px */
    --text-3xl: 2rem;        /* 32px */
    --text-4xl: 2.5rem;      /* 40px */
    --text-5xl: 3rem;        /* 48px */
    --text-6xl: 3.75rem;     /* 60px */

    /* Spacing - Consistent spacing system */
    --space-xs: 0.5rem;      /* 8px */
    --space-sm: 1rem;        /* 16px */
    --space-md: 1.5rem;      /* 24px */
    --space-lg: 2rem;        /* 32px */
    --space-xl: 3rem;        /* 48px */
    --space-2xl: 4rem;       /* 64px */
    --space-3xl: 6rem;       /* 96px */

    /* Layout */
    --container-max: 1200px;
    --header-height: 80px;

    /* Transitions */
    --transition-base: 0.3s ease;
    --transition-smooth: 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

/* ===== Global Reset & Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--color-primary);
    background-color: var(--color-background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Container - Consistent max-width and padding */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-md);
}

/* ===== Image Styles with Loading Effect ===== */
/* This creates a smooth fade-in effect as images load */
img {
    max-width: 100%;
    height: auto;
    display: block;
    /* Start with 0 opacity for fade-in effect */
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

/* When JavaScript adds the 'loaded' class, images fade in */
img.loaded {
    opacity: 1;
}

/* For browsers with JavaScript disabled, show images immediately */
.no-js img {
    opacity: 1;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }

p {
    margin-bottom: var(--space-sm);
    color: var(--color-secondary);
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-base);
}

/* ===== Announcement Bar ===== */
.announcement-bar {
    background-color: var(--color-surface);
    padding: var(--space-xs) 0;
    text-align: center;
    font-size: var(--text-sm);
    border-bottom: 1px solid var(--color-border);
}

.announcement-bar p {
    margin: 0;
    color: var(--color-primary);
    font-weight: 500;
}

/* ===== Header Styles ===== */
.main-header {
    position: sticky;
    top: 0;
    background-color: var(--color-background);
    box-shadow: 0 1px 0 var(--color-border);
    z-index: 1000;
    height: var(--header-height);
    transition: all var(--transition-base);
}

/* Header style when scrolled */
.main-header.scrolled {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    gap: var(--space-lg);
    position: relative;
}

/* Logo */
.logo {
    flex-shrink: 0;
}

.logo-text {
    font-size: var(--text-2xl);
    font-weight: 900;
    letter-spacing: -0.03em;
    color: var(--color-primary);
}

/* Navigation */
.main-nav {
    flex-grow: 1;
    display: flex;
    justify-content: center;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: var(--space-lg);
}

.nav-link {
    font-size: var(--text-base);
    font-weight: 500;
    position: relative;
    padding: var(--space-xs) 0;
    transition: color var(--transition-base);
}

.nav-link:hover {
    color: var(--color-accent);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--color-accent);
    transition: width var(--transition-smooth);
}

.nav-link:hover::after {
    width: 100%;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.cta-button {
    background-color: var(--color-accent);
    color: white;
    padding: var(--space-xs) var(--space-md);
    border-radius: 4px;
    font-weight: 600;
    transition: all var(--transition-base);
}

.cta-button:hover {
    background-color: var(--color-accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 86, 179, 0.2);
}

.language-toggle {
    background: none;
    border: 2px solid var(--color-border);
    padding: var(--space-xs) var(--space-sm);
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
}

.language-toggle:hover {
    border-color: var(--color-primary);
}

/* Mobile Menu Toggle (added by JavaScript) */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: var(--text-2xl);
    cursor: pointer;
    padding: var(--space-xs);
}

/* ===== Hero Section ===== */
.hero-section {
    display: flex;
    min-height: calc(100vh - var(--header-height) - 40px);
    align-items: center;
    overflow: hidden;
    gap: var(--space-2xl);
}

.hero-content {
    flex: 1;
    padding: var(--space-3xl) 0;
}

.hero-title {
    font-size: var(--text-6xl);
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: var(--space-md);
    letter-spacing: -0.04em;
}

.hero-subtitle {
    font-size: var(--text-xl);
    color: var(--color-secondary);
    margin-bottom: var(--space-xl);
    max-width: 600px;
}

/* Stats Grid */
.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
    max-width: 500px;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: var(--text-4xl);
    font-weight: 900;
    color: var(--color-accent);
    line-height: 1;
}

.stat-label {
    display: block;
    font-size: var(--text-sm);
    color: var(--color-secondary);
    margin-top: var(--space-xs);
}

/* Hero Actions */
.hero-actions {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.primary-button,
.secondary-button {
    padding: var(--space-sm) var(--space-lg);
    font-size: var(--text-base);
    font-weight: 600;
    border-radius: 4px;
    transition: all var(--transition-base);
    display: inline-block;
}

.primary-button {
    background-color: var(--color-primary);
    color: white;
}

.primary-button:hover {
    background-color: #000;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.secondary-button {
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
}

.secondary-button:hover {
    background-color: var(--color-primary);
    color: white;
}

.hero-image {
    flex: 1;
    position: relative;
    height: 600px;
}

.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

/* ===== Section Styles ===== */
section {
    padding: var(--space-3xl) 0;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

/* Sections become visible when JavaScript adds this class */
section.in-view {
    opacity: 1;
    transform: translateY(0);
}

.section-title {
    text-align: center;
    margin-bottom: var(--space-xl);
    font-size: var(--text-4xl);
}

.section-subtitle {
    text-align: center;
    font-size: var(--text-lg);
    color: var(--color-secondary);
    max-width: 600px;
    margin: 0 auto var(--space-xl);
}

/* ===== About Section ===== */
.about-section {
    background-color: var(--color-surface);
}

/* Company Gallery - Fixed layout for building images */
.company-gallery {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-2xl);
}

.gallery-main {
    overflow: hidden;
    border-radius: 8px;
}

.gallery-main img {
    width: 100%;
    height: 400px;
    object-fit: cover;
}

.gallery-grid {
    display: grid;
    grid-template-rows: 1fr 1fr;
    gap: var(--space-md);
}

.gallery-grid img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.about-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-lg);
}

.about-card {
    background: white;
    padding: var(--space-lg);
    border-radius: 8px;
    text-align: center;
    transition: all var(--transition-base);
}

.about-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.card-icon {
    font-size: var(--text-4xl);
    margin-bottom: var(--space-sm);
}

.about-card h3 {
    margin-bottom: var(--space-sm);
}

.about-card p {
    margin: 0;
}

/* ===== Facilities Section - Enhanced Grid Layout ===== */
.facilities-section {
    background-color: var(--color-background);
}

.facility-showcase {
    display: flex;
    flex-direction: column;
    gap: var(--space-2xl);
}

.facility-category {
    margin-bottom: var(--space-xl);
}

.facility-category h3 {
    font-size: var(--text-2xl);
    margin-bottom: var(--space-lg);
    color: var(--color-primary);
}

/* Fixed grid layout for facility images */
.facility-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
}

.facility-item {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all var(--transition-base);
}

.facility-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.facility-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.facility-item h4 {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--text-lg);
    color: var(--color-primary);
}

.facility-item p {
    padding: 0 var(--space-md) var(--space-md);
    font-size: var(--text-sm);
    color: var(--color-secondary);
}

/* ===== Products Section - Fixed Grid Layout ===== */
.products-section {
    background-color: var(--color-surface);
}

.product-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-3xl);
}

.category-card {
    background: white;
    padding: var(--space-lg);
    border-radius: 8px;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-base);
    min-height: 150px;
}

.category-card:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.category-percentage {
    font-size: var(--text-5xl);
    font-weight: 900;
    color: var(--color-accent);
    opacity: 0.1;
    position: absolute;
    top: -20px;
    right: -10px;
}

.category-card h3 {
    font-size: var(--text-lg);
    margin-bottom: var(--space-xs);
    position: relative;
}

.category-card p {
    font-size: var(--text-sm);
    margin: 0;
    position: relative;
}

/* Product Showcase Gallery */
.product-showcase {
    margin-top: var(--space-2xl);
}

.product-showcase h3 {
    text-align: center;
    font-size: var(--text-3xl);
    margin-bottom: var(--space-xl);
}

.product-category {
    margin-bottom: var(--space-2xl);
}

.product-category h4 {
    font-size: var(--text-xl);
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--color-accent);
}

/* Fixed product grid with consistent sizing */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-md);
}

.product-grid img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all var(--transition-base);
}

.product-grid img:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

/* ===== Quality Section ===== */
.quality-section {
    background-color: var(--color-background);
}

.quality-process {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3xl);
    flex-wrap: wrap;
}

.process-step {
    flex: 1;
    text-align: center;
    padding: var(--space-md);
    min-width: 200px;
}

.step-number {
    display: inline-block;
    width: 60px;
    height: 60px;
    line-height: 60px;
    background-color: var(--color-accent);
    color: white;
    border-radius: 50%;
    font-size: var(--text-xl);
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

.process-arrow {
    font-size: var(--text-2xl);
    color: var(--color-border);
    flex-shrink: 0;
}

/* Safety and Training Grids */
.safety-showcase,
.training-showcase {
    margin-top: var(--space-2xl);
}

.safety-showcase h3,
.training-showcase h3 {
    font-size: var(--text-2xl);
    margin-bottom: var(--space-lg);
    text-align: center;
}

.safety-grid,
.training-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-lg);
}

.safety-item,
.training-item {
    background: var(--color-surface);
    border-radius: 8px;
    overflow: hidden;
    text-align: center;
    transition: all var(--transition-base);
}

.safety-item:hover,
.training-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.safety-item img,
.training-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.safety-item h4,
.training-item h4 {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--text-lg);
}

.safety-item p,
.training-item p {
    padding: 0 var(--space-md) var(--space-md);
    font-size: var(--text-sm);
}

.certifications {
    background-color: var(--color-surface);
    padding: var(--space-xl);
    border-radius: 8px;
    text-align: center;
    margin-top: var(--space-2xl);
}

.cert-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
    margin-top: var(--space-lg);
}

.cert-item {
    background: white;
    padding: var(--space-md);
    border-radius: 4px;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* ===== Sustainability Section ===== */
.sustainability-section {
    background-color: var(--color-surface);
}

.sustainability-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2xl);
    align-items: center;
}

.sustainability-list {
    list-style: none;
    margin-top: var(--space-md);
}

.sustainability-list li {
    padding: var(--space-xs) 0;
    padding-left: var(--space-lg);
    position: relative;
}

.sustainability-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--color-accent);
    font-weight: bold;
    font-size: var(--text-lg);
}

.sustainability-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

/* ===== Contact Section ===== */
.contact-section {
    background-color: var(--color-background);
}

.location-showcase {
    text-align: center;
    margin-bottom: var(--space-2xl);
}

.location-showcase img {
    width: 100%;
    max-width: 800px;
    height: auto;
    margin: 0 auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.location-caption {
    margin-top: var(--space-sm);
    font-size: var(--text-sm);
    color: var(--color-secondary);
}

.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3xl);
    align-items: start;
}

.contact-details {
    margin-top: var(--space-lg);
}

.contact-item {
    margin-bottom: var(--space-lg);
    line-height: 1.8;
}

.contact-item strong {
    color: var(--color-primary);
}

/* Contact Form */
.contact-form form {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.contact-form input,
.contact-form select,
.contact-form textarea {
    padding: var(--space-sm);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-family: inherit;
    font-size: var(--text-base);
    transition: all var(--transition-base);
}

.contact-form input:focus,
.contact-form select:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.1);
}

.submit-button {
    background-color: var(--color-primary);
    color: white;
    padding: var(--space-sm) var(--space-lg);
    border: none;
    border-radius: 4px;
    font-size: var(--text-base);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
}

.submit-button:hover {
    background-color: #000;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

/* ===== Footer ===== */
.site-footer {
    background-color: var(--color-primary);
    color: white;
    padding: var(--space-2xl) 0 var(--space-lg);
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-3xl);
    margin-bottom: var(--space-xl);
}

.footer-brand h3 {
    margin-bottom: var(--space-xs);
}

.footer-brand p {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: var(--space-xs);
}

.footer-stats {
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
}

.footer-column h4 {
    font-size: var(--text-base);
    margin-bottom: var(--space-sm);
}

.footer-column ul {
    list-style: none;
}

.footer-column li {
    margin-bottom: var(--space-xs);
}

.footer-column a {
    color: rgba(255, 255, 255, 0.7);
    font-size: var(--text-sm);
}

.footer-column a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: var(--space-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.7);
}

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
    /* Tablet adjustments */
    .hero-section {
        flex-direction: column;
    }

    .hero-image {
        width: 100%;
        height: 400px;
    }

    .company-gallery {
        grid-template-columns: 1fr;
    }

    .gallery-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto;
    }

    .facility-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .contact-content,
    .sustainability-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    /* Mobile adjustments */
    :root {
        --text-6xl: 2.5rem;
        --text-5xl: 2rem;
        --text-4xl: 1.75rem;
    }

    .header-wrapper {
        flex-wrap: wrap;
    }

    .main-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .main-nav.mobile-active {
        max-height: 400px;
    }

    .nav-list {
        flex-direction: column;
        padding: var(--space-md);
        gap: var(--space-sm);
    }

    .mobile-menu-toggle {
        display: block !important;
    }

    .hero-stats {
        grid-template-columns: 1fr;
        text-align: left;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .facility-grid,
    .safety-grid,
    .training-grid {
        grid-template-columns: 1fr;
    }

    .product-categories {
        grid-template-columns: repeat(2, 1fr);
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .process-arrow {
        display: none;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }
}

/* ===== Utility Classes ===== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

/* ===== Loading State ===== */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

/* ===== No JavaScript Fallback ===== */
/* Add 'no-js' class to html element by default, remove it with JavaScript */
.no-js img {
    opacity: 1 !important;
}

.no-js section {
    opacity: 1 !important;
    transform: none !important;
}