/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Microsoft YaHei", sans-serif;
    line-height: 1.8;
    color: #333;
    background: #fff;
}

/* 导航栏 */
.navbar {
    background: #1f2937;
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-img {
    width: 100px;
    height: 100px;
    object-fit: contain;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    padding: .5rem;
}

.nav-menu a:hover {
    color: #ffad33;
}

/* Collapsible mobile nav (+ / -); injected by /nav.js */
.nav-toggle {
    display: none;
}

@media (max-width: 768px) {
    .navbar {
        padding: 0.45rem 0.65rem;
        padding-top: max(0.45rem, env(safe-area-inset-top, 0px));
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    }

    /* Default (no JS): company name full width + vertical links — no horizontal scroll */
    .nav-container {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.45rem;
        max-height: none;
    }

    .navbar .logo {
        font-size: 0.88rem;
        line-height: 1.3;
        gap: 8px;
        width: 100%;
        max-width: none;
        min-width: 0;
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
        flex-wrap: wrap;
        align-items: center;
    }

    .navbar .logo-img {
        position: static;
        top: auto;
        inset-inline-start: auto;
        transform: none;
        width: 44px;
        height: 44px;
        flex-shrink: 0;
    }

    .nav-menu {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 0;
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .nav-menu li {
        width: 100%;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav-menu a {
        display: block;
        padding: 0.5rem 0.15rem;
        font-size: 0.88rem;
        white-space: normal;
    }

    /* After nav.js: first row = company + toggle, links fold under + */
    .navbar[data-nav-mobile="1"] .nav-container {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "brand toggle"
            "menu menu";
        align-items: center;
        column-gap: 0.5rem;
        row-gap: 0.35rem;
    }

    .navbar[data-nav-mobile="1"] .logo {
        grid-area: brand;
    }

    .navbar[data-nav-mobile="1"] .nav-toggle {
        grid-area: toggle;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        padding: 0;
        border: 2px solid rgba(255, 255, 255, 0.9);
        border-radius: 6px;
        background: rgba(255, 255, 255, 0.08);
        color: #fff;
        font-size: 1.55rem;
        font-weight: 300;
        line-height: 1;
        cursor: pointer;
        flex-shrink: 0;
        -webkit-tap-highlight-color: transparent;
    }

    .navbar[data-nav-mobile="1"] .nav-menu {
        grid-area: menu;
    }

    .navbar[data-nav-mobile="1"]:not(.nav-open) .nav-menu {
        display: none;
    }

    .navbar[data-nav-mobile="1"].nav-open .nav-menu {
        display: flex;
        padding-top: 0.15rem;
    }
}

@media (max-width: 380px) {
    .navbar .logo {
        font-size: 0.8rem;
    }

    .navbar .logo-img {
        width: 38px;
        height: 38px;
    }

    .nav-menu a {
        font-size: 0.82rem;
    }
}

/* 宽屏（≥769px）：Logo 相对内容区与两行总高同高；公司名左对齐；导航居中 */
@media (min-width: 769px) {
    .nav-container {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.35rem;
        justify-content: flex-start;
        padding-inline-start: 0;
    }

    .navbar .logo {
        display: block;
        width: 100%;
        max-width: none;
        text-align: start;
        line-height: 1.35;
        margin: 0;
        padding-inline-start: clamp(3.25rem, calc(0.65rem + min(10.5rem, 22vw)), 6.75rem);
    }

    .navbar .logo-img {
        position: absolute;
        inset-inline-start: 0;
        top: 0;
        bottom: 0;
        height: 100%;
        width: auto;
        max-width: min(160px, 28vw);
        margin-block: 0;
        object-fit: contain;
        object-position: center left;
        flex-shrink: 0;
        transform: none;
        box-sizing: border-box;
    }

    .nav-menu {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 0.12rem 0.75rem;
        row-gap: 0.08rem;
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .nav-menu a {
        padding: 0.35rem 0.5rem;
        white-space: nowrap;
    }

    .navbar[data-nav-mobile="1"] .nav-container {
        display: flex !important;
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        align-items: stretch !important;
    }

    .navbar[data-nav-mobile="1"] .nav-toggle {
        display: none !important;
    }

    .navbar[data-nav-mobile="1"] .nav-menu,
    .navbar[data-nav-mobile="1"]:not(.nav-open) .nav-menu {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        width: 100% !important;
        justify-content: center !important;
    }

    .navbar[data-nav-mobile="1"] .nav-menu li {
        width: auto !important;
        border-top: none !important;
    }

    .navbar[data-nav-mobile="1"] .nav-menu a {
        display: inline !important;
        padding: 0.35rem 0.5rem !important;
        white-space: nowrap !important;
    }
}

/* 竖屏平板（含 iPad）：导航行整体增加起始留白约 10 字宽，避免叠在左侧满高 Logo 下；仍可 flex-wrap 换行 */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: portrait) {
    .nav-menu {
        padding-inline-start: 10ch;
        box-sizing: border-box;
    }

    .navbar[data-nav-mobile="1"] .nav-menu,
    .navbar[data-nav-mobile="1"]:not(.nav-open) .nav-menu {
        padding-inline-start: 10ch !important;
    }
}

/* 主要内容容器 */
.container {
    max-width: 1200px;
    margin: 3rem auto;
    padding: 0 1rem;
}

.page-title {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: #111827;
    border-left: 4px solid #ffad33;
    padding-left: 1rem;
}

.container p {
    font-size: 16px;
    line-height: 1.8;
    margin: 18px 0;
    text-align: justify;
    color: #333;
}

.container h2 {
    font-size: 22px;
    color: #222;
    margin: 30px 0 15px;
    padding-left: 12px;
    border-left: 4px solid #ffad33;
}

/* 按钮 */
.btn {
    display: inline-block;
    padding: .7rem 1.5rem;
    background: #ffad33;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    margin-top: 1rem;
}

.btn:hover {
    background: #e69529;
}

/* 公司简介大图区域 */
.hero-bg {
    min-height: 200px;
    height: auto;
    background: url('/images/company-bg.jpg') center/cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
    position: relative;
    padding: 60px 20px;
}

.hero-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 1000px;
    margin: 0 auto;
    color: #fff;
    text-align: left;
}

.hero-content h1 {
    font-size: 36px;
    margin-bottom: 30px;
    text-align: center;
}

.hero-content h2 {
    font-size: 22px;
    margin: 40px 0 20px;
    color: #fff;
}

.hero-content p {
    margin-bottom: 20px;
    font-size: 16px;
    line-height: 1.9;
}

/* ====================== 案例展示（横向排列 + 自动换行） ====================== */
.case-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 2rem;
    width: 100%;
    justify-content: flex-start;
}

.case-item {
    width: calc(33.333% - 14px);
    min-width: 260px;
    border: 1px solid #eee;
    border-radius: 6px;
    overflow: hidden;
    transition: .2s;
    margin-bottom: 10px;
}

@media (max-width: 900px) {
    .case-item {
        width: calc(50% - 10px);
    }
}

@media (max-width: 600px) {
    .case-item {
        width: 100%;
    }
}

.case-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.case-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.case-info {
    padding: 1rem;
}

.case-info h3 {
    font-size: 1.1rem;
    margin-bottom: .5rem;
}

.case-info a {
    color: #ffad33;
    text-decoration: none;
}
/* ================================================================================== */

/* 图片组样式 */
.img-group {
    margin: 30px 0;
}
.img-group img {
    max-width: 100%;
    height: auto;
    margin: 10px 0;
    border-radius: 4px;
}

/* Clickable YouTube thumbnails: center play affordance (case pages, index, iml, etc.) */
a[href*="youtu"]:has(> img) {
    position: relative;
    display: inline-block;
    max-width: 100%;
    vertical-align: middle;
    line-height: 0;
}

a[href*="youtu"]:has(> img) > img {
    display: block;
    max-width: 100%;
    height: auto;
}

a[href*="youtu"]:has(> img)::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: clamp(52px, 16vmin, 84px);
    height: clamp(52px, 16vmin, 84px);
    border-radius: 50%;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.52)
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M8 5v14l11-7z'/%3E%3C/svg%3E")
        center / 48% 48% no-repeat;
    box-shadow: 0 4px 22px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

a[href*="youtu"]:has(> img):hover::after,
a[href*="youtu"]:has(> img):focus-visible::after {
    transform: translate(-50%, -50%) scale(1.07);
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.5);
}

a[href*="youtu"]:has(> img):focus-visible {
    outline: 3px solid #ffad33;
    outline-offset: 3px;
}

/* 页脚 */
.footer {
    background: #1f2937;
    color: #ffffff !important;
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 6rem;
}