/* ==========================================================================
   Yiwu World Bridge — Premium Corporate Theme
   Palette: #FCFCFD · #07469F · #5280BE · #676769 · #9CA2AB · #CCD0D5
   Loaded after each page's inline styles; Tailwind utilities are remapped
   through the per-page tailwind.config so this layer only handles polish.
   ========================================================================== */

:root {
    --wb-navy: #07469F;
    --wb-navy-deep: #04244E;
    --wb-blue: #5280BE;
    --wb-ink: #2B2C2F;
    --wb-slate: #676769;
    --wb-muted: #9CA2AB;
    --wb-line: #CCD0D5;
    --wb-paper: #FCFCFD;
    --wb-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ==================== Base ==================== */

html {
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: 96px;
}

body {
    background-color: var(--wb-paper);
    color: var(--wb-slate);
    letter-spacing: 0.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    letter-spacing: -0.015em;
}

::selection {
    background: rgba(82, 128, 190, 0.22);
    color: var(--wb-navy-deep);
}

::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #CCD0D5;
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9CA2AB;
}

:focus-visible {
    outline: 2px solid rgba(82, 128, 190, 0.55);
    outline-offset: 2px;
}

/* ==================== Header ==================== */

header.fixed {
    background: rgba(252, 252, 253, 0.92) !important;
    border-bottom: 1px solid rgba(204, 208, 213, 0.75);
    box-shadow: none !important;
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    backdrop-filter: saturate(180%) blur(16px);
}

header nav.hidden > a,
header nav.hidden .nav-dropdown-wrap > a {
    position: relative;
    padding-bottom: 4px;
}

@media (min-width: 1024px) {
    header nav.hidden > a,
    header nav.hidden .nav-dropdown-wrap > a {
        font-size: 0.82rem;
        letter-spacing: 0.07em;
        text-transform: uppercase;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    header nav.hidden > a,
    header nav.hidden .nav-dropdown-wrap > a {
        font-size: 0.74rem;
        letter-spacing: 0.01em;
    }
}

header nav.hidden > a::after,
header nav.hidden .nav-dropdown-wrap > a::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 2px;
    background: linear-gradient(90deg, var(--wb-navy), var(--wb-blue));
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.3s var(--wb-ease);
}

header nav.hidden > a:hover::after,
header nav.hidden .nav-dropdown-wrap:hover > a::after,
header nav.hidden > a.text-primary-600::after,
header nav.hidden .nav-dropdown-wrap > a.text-primary-600::after {
    transform: scaleX(1);
}

header nav.hidden > .lang-switcher button,
header .lang-switcher button {
    font-size: 0.82rem;
    letter-spacing: 0.04em;
}

/* Dropdown */
.nav-dropdown-menu {
    border: 1px solid #E9EBEF;
    border-radius: 10px;
    padding: 8px;
    box-shadow: 0 24px 48px -24px rgba(4, 36, 78, 0.35);
}

.nav-dropdown-menu a {
    color: #54555A;
    font-size: 0.875rem;
    letter-spacing: 0.01em;
}

/* ==================== Section rhythm ==================== */

section h2.font-bold {
    letter-spacing: -0.02em;
}

.text-center h2.font-bold::after {
    content: '';
    display: block;
    width: 46px;
    height: 2px;
    margin: 1rem auto 0;
    background: linear-gradient(90deg, var(--wb-navy), var(--wb-blue));
    border-radius: 2px;
}

section.bg-primary-600 .text-center h2.font-bold::after,
section.bg-primary-600 h2.font-bold::after,
section.bg-primary-700 h2.font-bold::after,
section.bg-primary-800 h2.font-bold::after,
section.bg-primary-900 h2.font-bold::after {
    background: linear-gradient(90deg, #FFFFFF, rgba(255, 255, 255, 0.35));
}

/* ==================== Cards ==================== */

section .business-card,
section .service-card,
section .product-card,
section .team-card,
section .info-card,
section .about-card,
section .news-item,
main .news-item {
    border: 1px solid #E9EBEF;
    transition: transform 0.35s var(--wb-ease), box-shadow 0.35s var(--wb-ease), border-color 0.35s var(--wb-ease);
}

section .business-card:hover,
section .service-card:hover,
section .product-card:hover,
section .team-card:hover,
section .info-card:hover,
section .about-card:hover,
section .news-item:hover,
main .news-item:hover {
    border-color: #D6DFEC;
    box-shadow: 0 28px 56px -30px rgba(4, 36, 78, 0.35);
}

section .team-card {
    border-radius: 12px;
}

section .team-overlay {
    background: linear-gradient(160deg, rgba(4, 36, 78, 0.94), rgba(7, 70, 159, 0.88)) !important;
}

/* ==================== Page banner ==================== */

.page-banner {
    position: relative;
    overflow: hidden;
}

.page-banner::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 64px 64px;
    pointer-events: none;
}

.page-banner .container {
    position: relative;
    z-index: 1;
}

.page-banner h1 {
    letter-spacing: -0.02em;
}

/* ==================== Footer ==================== */

/* 页脚样式由 js/footer.js 统一注入（.sf- 前缀），此处不再维护旧版页脚规则 */

/* ==================== Buttons & small details ==================== */

section .view-more-btn {
    padding: 0.8rem 2.6rem !important;
    border-radius: 9999px !important;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.78rem;
}

.chat-button.bg-primary-600 {
    box-shadow: 0 20px 40px -16px rgba(7, 70, 159, 0.65);
}

.chat-window {
    border: 1px solid #E9EBEF;
    border-radius: 14px;
    box-shadow: 0 32px 64px -32px rgba(4, 36, 78, 0.45) !important;
}

.chat-message.user-message {
    background-color: #E4EBF5;
}

.chat-message.ai-message {
    background-color: #F1F2F5;
}

.social-icon-btn:hover {
    background-color: rgba(82, 128, 190, 0.12) !important;
    border-color: var(--wb-blue) !important;
}

.filter-btn.active,
.page-link.active {
    background-color: var(--wb-navy) !important;
    border-color: var(--wb-navy) !important;
    color: #FFFFFF !important;
}

.filter-btn.active:hover {
    background-color: #063B85 !important;
}

/* ==================== Homepage editorial layout ==================== */

.product-bento {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: 260px 260px 220px;
    grid-template-areas:
        "hero hero solar solar"
        "hero hero auto hardware"
        "packaging packaging pumps piping";
    gap: 20px;
}

.bento-item {
    position: relative;
    min-height: 220px;
    overflow: hidden;
    isolation: isolate;
    border-radius: 18px;
    background: var(--wb-navy-deep);
    box-shadow: 0 1px 0 rgba(4, 36, 78, 0.08);
}

.bento-item::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(180deg, rgba(4, 36, 78, 0.02) 20%, rgba(4, 36, 78, 0.9) 100%);
    transition: background 0.35s var(--wb-ease);
}

.bento-visual {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 75% 20%, rgba(82, 128, 190, 0.65), transparent 55%), linear-gradient(135deg, #052F6B, #07469F);
    color: rgba(255, 255, 255, 0.25);
}

.bento-visual i {
    font-size: clamp(4rem, 9vw, 8rem);
    transform: rotate(-8deg);
    transition: transform 0.65s var(--wb-ease), color 0.65s var(--wb-ease);
}

.bento-item:hover .bento-visual i {
    transform: rotate(-3deg) scale(1.08);
    color: rgba(255, 255, 255, 0.36);
}

.bento-item:hover::after {
    background: linear-gradient(180deg, rgba(4, 36, 78, 0.04) 15%, rgba(7, 70, 159, 0.92) 100%);
}

.bento-item .bento-content {
    position: absolute;
    inset: auto 0 0;
    z-index: 2;
    padding: 26px;
    color: #FFFFFF;
}

.bento-item .bento-index {
    position: absolute;
    top: 22px;
    left: 24px;
    z-index: 2;
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.18em;
}

.bento-item .bento-arrow {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 999px;
    color: #FFFFFF;
    opacity: 0;
    transform: translate(-5px, 5px);
    transition: opacity 0.3s ease, transform 0.3s ease, background 0.3s ease;
}

.bento-item:hover .bento-arrow {
    opacity: 1;
    transform: translate(0, 0);
    background: rgba(255, 255, 255, 0.12);
}

.bento-hero { grid-area: hero; }
.bento-solar { grid-area: solar; }
.bento-auto { grid-area: auto; }
.bento-hardware { grid-area: hardware; }
.bento-packaging { grid-area: packaging; }
.bento-pumps { grid-area: pumps; }
.bento-piping { grid-area: piping; }

.bento-hero .bento-content { padding: 34px; }
.bento-auto .bento-desc,
.bento-hardware .bento-desc { display: none; }

.advantage-row {
    transition: padding-left 0.3s var(--wb-ease), background 0.3s var(--wb-ease);
}

.advantage-row:hover {
    padding-left: 14px;
    background: linear-gradient(90deg, rgba(228, 235, 245, 0.65), transparent 80%);
}

.advantage-row .advantage-icon {
    transition: color 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}

.advantage-row:hover .advantage-icon {
    color: #FFFFFF;
    border-color: var(--wb-navy);
    background: var(--wb-navy);
}

@media (max-width: 1023px) {
    .product-bento {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: 340px 240px 240px 220px;
        grid-template-areas:
            "hero hero"
            "solar auto"
            "hardware packaging"
            "pumps piping";
    }
}

@media (max-width: 639px) {
    .product-bento {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: 320px repeat(6, 230px);
        grid-template-areas:
            "hero"
            "solar"
            "auto"
            "hardware"
            "packaging"
            "pumps"
            "piping";
        gap: 14px;
    }

    .bento-item .bento-content,
    .bento-hero .bento-content { padding: 22px; }
    .bento-auto .bento-desc,
    .bento-hardware .bento-desc { display: block; }
    .bento-item .bento-arrow { opacity: 1; transform: none; }
}

/* ==================== Location map ==================== */

[data-wb-map] {
    position: relative;
    z-index: 0;
    min-height: 240px;
    background: #E9EDF2;
}

.leaflet-container {
    font-family: inherit;
    background: #E9EDF2;
}

.wb-map-pin {
    background: transparent;
    border: 0;
}

.wb-map-pin__dot {
    position: absolute;
    inset: 3px;
    border: 2px solid #FFFFFF;
    border-radius: 50%;
    background: #07469F;
    box-shadow: 0 2px 8px rgba(4, 36, 78, 0.35);
}

.wb-map-pin__pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(7, 70, 159, 0.28);
    animation: wb-map-pulse 2.2s ease-out infinite;
}

@keyframes wb-map-pulse {
    0% { transform: scale(0.6); opacity: 0.9; }
    70% { transform: scale(2.3); opacity: 0; }
    100% { transform: scale(2.3); opacity: 0; }
}

.leaflet-popup-content-wrapper {
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(4, 36, 78, 0.16);
}

.leaflet-popup-content {
    margin: 13px 16px;
}

.wb-map-popup {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-width: 220px;
}

.wb-map-popup strong {
    color: #0B2D5C;
    font-size: 13px;
    line-height: 1.4;
}

.wb-map-popup span {
    color: #676769;
    font-size: 12px;
    line-height: 1.6;
}

.wb-map-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: #EDF1F6;
}

.wb-map-fallback a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 999px;
    background: #07469F;
    color: #FFFFFF;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.25s ease;
}

.wb-map-fallback a:hover {
    background: #0B2D5C;
}

/* ==================== Dark theme compatibility (news page) ==================== */

body.dark-theme header.fixed {
    background: rgba(45, 55, 72, 0.94) !important;
    border-bottom-color: #4A5568;
}

body.dark-theme .nav-dropdown-menu {
    background: #2D3748;
    border-color: #4A5568;
}

body.dark-theme .nav-dropdown-menu a {
    color: #CBD5E0;
}

body.dark-theme section .news-item,
body.dark-theme main .news-item {
    border-color: #4A5568;
}

body.dark-theme .chat-window {
    border-color: #4A5568;
}

/* ==================== Mobile refinement ==================== */

@media (max-width: 767px) {
    html {
        scroll-padding-top: 84px;
    }

    /* Tighter section rhythm so content is not lost in whitespace */
    section[class*="py-24"] {
        padding-top: 3.5rem;
        padding-bottom: 3.5rem;
    }

    section[class*="py-20"] {
        padding-top: 3.25rem;
        padding-bottom: 3.25rem;
    }

    /* Page banners sit below the fixed header and use a calmer type scale */
    .page-banner {
        padding-top: 6.75rem !important;
        padding-bottom: 2.75rem !important;
    }

    .page-banner h1 {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }

    .page-banner p {
        font-size: 1rem;
    }

    /* Homepage hero: use dynamic viewport height and mobile-friendly type */
    #home .h-screen {
        height: 100svh;
        min-height: 560px;
    }

    #home .h-screen .container {
        padding-top: 88px;
        padding-bottom: 72px;
    }

    #home .hero-slide h2 {
        font-size: 1.05rem;
        letter-spacing: 0.02em;
        margin-bottom: 0.6rem;
    }

    #home .hero-slide h1 {
        font-size: 1.95rem;
        line-height: 1.22;
        margin-bottom: 0.85rem;
    }

    #home .hero-slide p {
        font-size: 0.95rem;
        line-height: 1.65;
        margin-bottom: 1.5rem;
    }

    #home .hero-slide a {
        padding: 0.8rem 1.6rem;
        font-size: 0.9rem;
    }

    #home .hero-slide .container > div {
        max-width: 100%;
    }

    /* Filter chips: single swipeable row instead of 3-4 wrapped rows */
    .mobile-chip-scroll {
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        overflow-x: auto;
        gap: 10px !important;
        padding: 2px 0 8px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
    }

    .mobile-chip-scroll::-webkit-scrollbar {
        display: none;
    }

    .mobile-chip-scroll > * {
        flex: 0 0 auto;
        scroll-snap-align: start;
    }

    /* Keep long body copy readable */
    section p {
        word-break: break-word;
    }
}

@media (hover: none) {
    /* Avoid sticky hover states on touch devices */
    section .business-card:hover,
    section .service-card:hover,
    section .product-card:hover,
    section .team-card:hover,
    section .info-card:hover,
    section .about-card:hover,
    section .news-item:hover {
        transform: none;
    }
}
