:root {
    --paper: #f4f4f5;
    --paper-light: #ffffff;
    --ink: #111111;
    --muted: #666666;
    --line: #e5e5e5;
    --accent: #002b5c;
    --font-serif: "Playfair Display", "Georgia", serif;
    --font-sans: "Inter", system-ui, sans-serif;
    --container-width: 1400px;
}

/* Fix for flowery ampersand in serif fonts */
@font-face {
    font-family: 'SimpleAmp';
    src: local('Inter'), local('Arial'), sans-serif;
    unicode-range: U+0026;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--paper);
    color: var(--ink);
    line-height: 1.6;
    scrollbar-gutter: stable; /* Keeps navbar width consistent */
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'SimpleAmp', var(--font-serif);
}

/* Navbar */
.navbar {
    position: sticky;
    top: 0;
    background: var(--paper-light);
    z-index: 100;
    border-bottom: 1px solid var(--line);
}
.nav-container {
    max-width: var(--container-width);
    width: 100%;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    flex: 1; /* Give logo some space */
}
.nav-links {
    flex: 2;
    display: flex;
    justify-content: center;
}
.nav-actions {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}
.nav-links a {
    text-decoration: none;
    color: var(--ink);
    margin: 0 10px;
    font-weight: 500;
    font-size: 0.85rem;
    transition: color 0.3s;
}
.nav-links a:hover {
    color: var(--accent);
}
.btn {
    padding: 7px 12px;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}
.btn-primary {
    background-color: var(--ink);
    color: var(--paper-light);
}
.btn-primary:hover {
    background-color: var(--accent);
}

/* Hero Section */
.hero {
    height: 72vh;
    min-height: 560px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background-color: #e0e0e0; /* Fallback */
    background-image: linear-gradient(rgba(255,255,255,0.8), rgba(255,255,255,0.9)), url('factory/photos/封面主图.png');
    background-size: cover;
    background-position: center;
}
.hero-content {
    max-width: 900px;
    padding: 0 20px;
}
.hero h1 {
    font-family: var(--font-serif);
    font-size: 3.4rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--ink);
    letter-spacing: -0.02em;
}
.hero h2 {
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--muted);
    margin-bottom: 28px;
}
.hero-stats {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.1em;
}
.hero-stats .divider {
    color: var(--muted);
    margin: 0 15px;
}

/* Manifest */
.manifest {
    background-color: var(--ink);
    color: var(--paper-light);
    padding: 56px 28px;
}
.manifest-grid {
    max-width: var(--container-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px;
}
.manifest-card h3 {
    font-family: var(--font-sans);
    font-size: 1.7rem;
    margin-bottom: 15px;
    line-height: 1.1;
    letter-spacing: -0.03em;
}
.manifest-card p {
    color: #a0a0a0;
    font-size: 1rem;
}

/* Narratives */
.narratives {
    background-color: var(--paper);
}
.narrative-section {
    min-height: auto;
    display: flex;
    align-items: center;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 48px 28px;
    gap: 36px;
}
.narrative-section.dark-bg {
    background-color: var(--ink);
    color: var(--paper-light);
    max-width: 100%;
    padding: 68px 7%;
}
.narrative-section.dark-bg .narrative-text p {
    color: #a0a0a0;
}
.layout-left {
    flex-direction: row;
}
.layout-right {
    flex-direction: row-reverse;
}
.narrative-text {
    flex: 1.1;
}
.narrative-text h2 {
    font-family: var(--font-serif);
    font-size: 2rem;
    margin-bottom: 14px;
    line-height: 1.2;
}
.narrative-text p {
    font-size: 1rem;
    color: var(--muted);
}
.narrative-text li {
    font-size: 1rem;
}
.narrative-media {
    flex: 0.9;
    position: relative;
    height: 42vh;
    min-height: 300px;
    overflow: hidden;
    background: #ccc;
}

.narrative-media.show-play-hint::after {
    content: "▶";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.58);
    color: #fff;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    pointer-events: none;
}
.narrative-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(0.86) contrast(0.95) brightness(0.96);
    cursor: pointer;
}
.narrative-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.narrative-media.contain-media {
    /* Inherits standard height from .narrative-media */
}
.narrative-media.contain-media img {
    object-fit: contain;
    background: var(--ink);
}

/* Slider */
.slider-container {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.5s ease-in-out;
}
.slider-container img {
    flex-shrink: 0;
}
.slider-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
}
.slider-controls button {
    background: rgba(255,255,255,0.8);
    border: none;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1.2rem;
    border-radius: 50%;
    transition: background 0.3s;
}
.slider-controls button:hover {
    background: #fff;
}

/* Service SOP */
.service-sop {
    background: var(--paper-light);
    padding: 56px 28px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.service-sop-header {
    max-width: var(--container-width);
    margin: 0 auto 2.2rem auto;
    text-align: center;
}

.service-sop-header h2 {
    font-family: var(--font-serif);
    font-size: 2rem;
    color: var(--ink);
    margin-bottom: 0.8rem;
}

.service-sop-header p {
    color: var(--muted);
    font-size: 1rem;
}

.service-sop-grid {
    max-width: var(--container-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.sop-card {
    background: var(--paper);
    border: 1px solid var(--line);
    padding: 16px;
    min-height: 140px;
}

.sop-card h3 {
    font-size: 1.1rem;
    line-height: 1.3;
    margin-bottom: 0.8rem;
    color: var(--ink);
}

.sop-card p {
    color: var(--muted);
    font-size: 0.95rem;
}

.service-sop-action {
    max-width: var(--container-width);
    margin: 2rem auto 0 auto;
    text-align: center;
}

/* CTA */
.cta-section {
    background-color: var(--ink);
    color: var(--paper-light);
    text-align: center;
    padding: 64px 20px;
}
.cta-content h2 {
    font-family: var(--font-serif);
    font-size: 2.2rem;
    margin-bottom: 20px;
}
.btn-large {
    font-size: 1.1rem;
    padding: 16px 32px;
    display: inline-block;
    background: var(--paper-light);
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
}
.btn-large:hover {
    background: var(--accent);
    color: #fff;
}

/* Gallery */
.gallery-section {
    padding: 56px 28px;
    max-width: var(--container-width);
    margin: 0 auto;
}
.gallery-header {
    text-align: center;
    margin-bottom: 42px;
}
.gallery-header h2 {
    font-family: var(--font-serif);
    font-size: 2rem;
    margin-bottom: 20px;
}
.filter-tabs {
    display: flex;
    justify-content: center;
    gap: 20px;
}
.filter-btn {
    background: none;
    border: none;
    font-size: 1rem;
    color: var(--muted);
    cursor: pointer;
    padding-bottom: 5px;
    border-bottom: 2px solid transparent;
}
.filter-btn.active, .filter-btn:hover {
    color: var(--ink);
    border-bottom-color: var(--ink);
}
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 14px;
}
.gallery-item {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    object-position: center 78%;
    background: #eee;
    transition: filter 0.3s;
}
.gallery-more {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--line);
    background: var(--paper-light);
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}
.gallery-item.hidden {
    display: none;
}

.gallery-grid img.gallery-item {
    aspect-ratio: 3 / 3.15;
    object-position: center 86%;
    cursor: zoom-in;
}

/* Bento Grid */
.trust-bento {
    padding: 56px 28px;
    background: var(--paper);
}

.bento-header {
    text-align: center;
    margin-bottom: 2rem;
}

.bento-header h2 {
    font-family: var(--font-serif);
    font-size: 2rem;
    color: var(--ink);
    margin-bottom: 1rem;
}

.bento-header p {
    font-size: 1.05rem;
    color: var(--muted);
}

.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 240px;
    gap: 14px;
    max-width: var(--container-width);
    margin: 0 auto;
}

.bento-grid-duo {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: auto;
    max-width: 1000px;
}

.bento-grid-trio {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: auto;
    max-width: 1180px;
}

.bento-grid-duo .bento-video,
.bento-grid-duo .bento-photo,
.bento-grid-trio .bento-video,
.bento-grid-trio .bento-photo {
    height: 320px;
    min-height: 320px;
    aspect-ratio: auto;
}

.bento-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    background-color: var(--paper-light);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.1rem;
    color: white;
}

.bento-large {
    grid-column: span 2;
}

.bento-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.2) 50%, rgba(0,0,0,0.1) 100%);
    z-index: 1;
    pointer-events: none;
}

.bento-overlay-light {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.5) 0%, transparent 50%);
    z-index: 1;
}

.bento-content {
    position: relative;
    z-index: 2;
}

.bento-content.center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
}

.bento-content.bottom-left {
    height: 100%;
    display: flex;
    align-items: flex-end;
}

.bento-tag {
    display: inline-block;
    background: var(--accent);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bento-item h3 {
    font-family: var(--font-sans);
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.bento-meta {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

.bento-text-card {
    background-color: var(--ink);
    color: white;
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bento-text-card h3 {
    font-size: 1.5rem;
    color: white;
    margin-bottom: 0.5rem;
}

.bento-text-card p {
    color: var(--muted);
    font-size: 1rem;
}

.bento-video {
    cursor: pointer;
    background-color: #ccc;
}

.bento-poster {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.bento-video .play-icon {
    position: absolute;
    top: 0.9rem;
    right: 0.9rem;
    width: 38px;
    height: 38px;
    background: rgba(255, 0, 0, 0.9);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    z-index: 2;
    transition: transform 0.3s ease;
}

.bento-video:hover .play-icon {
    transform: scale(1.1);
}

.showroom-card {
    padding: 0;
    display: block;
}

.showroom-track {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
}

.showroom-image {
    width: 100%;
    min-width: 100%;
    height: 100%;
    object-fit: cover;
    scroll-snap-align: start;
    cursor: zoom-in;
}

.showroom-card .bento-content.bottom-left {
    position: absolute;
    left: 12px;
    bottom: 12px;
    height: auto;
    display: block;
    pointer-events: none;
}

.showroom-controls {
    position: absolute;
    right: 10px;
    top: 10px;
    display: flex;
    gap: 8px;
    z-index: 3;
}

.showroom-controls button {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
}

.image-modal #modal-image {
    width: 82vw;
    max-height: 82vh;
    object-fit: contain;
}

/* Modal */
.video-modal {
    margin: auto;
    border: none;
    background: transparent;
    max-width: 90vw;
    max-height: 90vh;
}
.video-modal::backdrop {
    background: rgba(0, 0, 0, 0.9);
}
.modal-content {
    position: relative;
}
.modal-content video {
    width: 80vw;
    max-height: 80vh;
}
.close-video-modal,
.close-image-modal {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    z-index: 5;
}

.image-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 4;
}

.image-prev {
    left: 14px;
}

.image-next {
    right: 14px;
}

.footer {
    text-align: center;
    padding: 28px;
    background: var(--ink);
    color: var(--muted);
}

@media (max-width: 1024px) {
    .manifest-grid, .bento-grid, .service-sop-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .narrative-section {
        flex-direction: column !important;
        padding: 38px 16px;
        gap: 24px;
    }
    .narrative-media {
        width: 100%;
        height: 44vh;
        min-height: 280px;
    }
    .bento-grid-duo .bento-video,
    .bento-grid-duo .bento-photo,
    .bento-grid-trio .bento-video,
    .bento-grid-trio .bento-photo {
        height: 280px;
        min-height: 280px;
    }
    .service-sop-header h2 {
        font-size: 2rem;
    }
}
@media (max-width: 768px) {
    .hero h1 { font-size: 2.4rem; }
    .hero h2 { font-size: 1.2rem; }
    .manifest-grid, .bento-grid, .service-sop-grid {
        grid-template-columns: 1fr;
    }
    .bento-large {
        grid-column: span 1;
    }
    .bento-header h2 {
        font-size: 2rem;
    }
    .service-sop {
        padding: 70px 20px;
    }
    .service-sop-header h2 {
        font-size: 2rem;
    }
    .sop-card {
        min-height: auto;
    }
    .narrative-media {
        height: 38vh;
        min-height: 240px;
    }
    .bento-grid-duo .bento-video,
    .bento-grid-duo .bento-photo,
    .bento-grid-trio .bento-video,
    .bento-grid-trio .bento-photo {
        height: 260px;
        min-height: 260px;
    }
}

/* Floating Chat Widget */
.floating-chat-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.chat-bubble {
    background: #fff;
    padding: 12px 18px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    font-size: 0.95rem;
    color: var(--ink);
    max-width: 220px;
    position: relative;
    animation: fadeInSlideUp 0.3s ease-out;
    border: 1px solid var(--line);
    display: none;
}

.floating-chat-container:hover .chat-bubble {
    display: block;
}

.close-bubble {
    position: absolute;
    top: 4px;
    right: 6px;
    background: none;
    border: none;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    color: var(--muted);
    padding: 2px;
}

.close-bubble:hover {
    color: var(--ink);
}

.chat-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 20px;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #fff;
}

.floating-chat-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #25D366; /* WhatsApp Green default */
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: transform 0.3s, background 0.3s;
    text-decoration: none;
}

.floating-chat-btn:hover {
    transform: scale(1.1);
}

.floating-chat-btn.wechat {
    background: #07C160; /* WeChat Green */
}

.floating-chat-btn svg {
    width: 32px;
    height: 32px;
    fill: #fff;
}

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

@media (max-width: 768px) {
    .floating-chat-container {
        bottom: 20px;
        right: 20px;
    }
    .floating-chat-btn {
        width: 54px;
        height: 54px;
    }
}

/* QR Modal */
.qr-modal {
    max-width: 320px;
    width: 90%;
    margin: auto; /* Centers the dialog */
    border-radius: 16px;
    padding: 0;
    overflow: hidden;
    border: none;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.qr-modal::backdrop {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.qr-modal-content {
    background: #fff;
    padding: 30px;
    text-align: center;
    position: relative;
}

.qr-modal-content h3 {
    font-size: 1.1rem;
    margin-bottom: 5px;
    color: var(--ink);
}

.qr-modal-content p {
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 20px;
}

.qr-image {
    width: 220px;
    height: 220px;
    margin: 0 auto 15px auto;
    display: block;
    border: 1px solid var(--line);
    padding: 5px;
}

.close-qr-modal {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--muted);
}

/* Chinese Language Specific Adjustments */
html[lang="zh-CN"] body {
    font-size: 1rem; /* Matched with English for better readability */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html[lang="zh-CN"] .hero h1 {
    font-size: 3.4rem; /* Matched with English */
}

html[lang="zh-CN"] .hero h2 {
    font-size: 1.15rem; /* Slightly larger sub-hero */
}

html[lang="zh-CN"] .hero-stats {
    font-size: 1rem;
}

html[lang="zh-CN"] h2, 
html[lang="zh-CN"] .narrative-text h2, 
html[lang="zh-CN"] .service-sop-header h2, 
html[lang="zh-CN"] .bento-header h2, 
html[lang="zh-CN"] .gallery-header h2 {
    font-size: 2.2rem; /* Consistent large headings */
}

html[lang="zh-CN"] .manifest-card h3 {
    font-size: 1.8rem; /* Consistent manifest card titles */
}

html[lang="zh-CN"] .sop-card h3 {
    font-size: 1.2rem; /* Consistent SOP card titles */
}

html[lang="zh-CN"] .bento-item h3 {
    font-size: 1.3rem; /* Consistent bento titles */
}

html[lang="zh-CN"] .narrative-text p, 
html[lang="zh-CN"] .manifest-card p, 
html[lang="zh-CN"] .sop-card p, 
html[lang="zh-CN"] .service-sop-header p, 
html[lang="zh-CN"] .bento-header p {
    font-size: 1rem; /* Matched with English */
}

html[lang="zh-CN"] .lead-magnet {
    font-size: 0.8rem !important;
}

@media (max-width: 768px) {
    html[lang="zh-CN"] .hero h1 { font-size: 2.4rem; }
    html[lang="zh-CN"] h2, 
    html[lang="zh-CN"] .narrative-text h2, 
    html[lang="zh-CN"] .service-sop-header h2, 
    html[lang="zh-CN"] .bento-header h2 {
        font-size: 1.8rem;
    }
}
