/* 展示侧（C 端）样式。
 *
 * 没有沿用旧站那套 CSS——它是 bootstrap 3 加三份自定义覆盖叠出来的，页面里还带着
 * 内联的 font-size / text-indent。这里按同一批元素重写：页头 + 导航 + 轮播 + 卡片
 * 网格 + 文章正文 + 分页。
 *
 * 规矩：只有一个主色（深蓝）、一个强调色（橙），其余靠灰阶拉开层次；圆角和阴影
 * 都克制，企业站不要花。
 */

:root {
    --ink: #16202b;
    --ink-2: #5a6b7c;
    --ink-3: #94a3b2;
    --line: #e4e9ee;
    --bg: #fff;
    --bg-2: #f6f8fa;
    --brand: #0d4f75;
    --brand-2: #0a7ea4;
    --accent: #d98324;
    --wrap: 1180px;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 32, 48, .06), 0 10px 28px rgba(16, 32, 48, .07);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.75 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.wrap { width: min(100% - 40px, var(--wrap)); margin-inline: auto; }
.main { padding: 26px 0 72px; }

/* ---------------------------------------------------------------- 页头 */

.site-head { background: #fff; border-bottom: 1px solid var(--line); }

/* logo、导航、语言切换排在同一行 */
.head-bar {
    display: flex; align-items: center; gap: 30px;
    min-height: 74px;
}

/* flex: 0 1 auto + min-width: 0 —— logo 在窄屏要能让位，
   不然它会把语言切换和汉堡按钮顶出屏幕（flex: none 是既不能缩也不能长） */
.brand { flex: 0 1 auto; min-width: 0; font-size: 21px; font-weight: 700; letter-spacing: .5px; color: var(--brand); }
.brand img { display: block; max-height: 46px; max-width: 100%; width: auto; }

.lang {
    flex: none; font-size: 14px; color: var(--ink-2);
    border: 1px solid var(--line); border-radius: 999px; padding: 5px 15px;
    transition: border-color .15s, color .15s;
}
.lang:hover { border-color: var(--brand-2); color: var(--brand-2); }

/* 搜索框：输入框和按钮拼成一个圆角条 */
.site-search {
    flex: none; display: flex; align-items: center;
    border: 1px solid var(--line); border-radius: 999px; overflow: hidden;
    background: #fff;
}
/* 焦点环画在容器外面（box-shadow）：输入框和按钮任一获得焦点都显示，
   也不会被容器的 overflow: hidden 裁掉 */
.site-search:focus-within { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(10, 126, 164, .22); }
.site-search-input {
    width: 150px; min-width: 0; padding: 5px 4px 5px 15px;
    border: 0; outline: 0; background: none;
    font: inherit; font-size: 14px; color: var(--ink);
}
.site-search-btn {
    display: flex; align-items: center; padding: 6px 12px 6px 6px;
    border: 0; background: none; color: var(--ink-2); cursor: pointer;
}
.site-search-btn:hover { color: var(--brand-2); }

/* 汉堡按钮：只在窄屏出现（宽屏由下面的 @media 之外的规则藏起来）。
   三条横线是按钮里的三个 span，展开时上下两条旋转成 ×、中间那条淡出。 */
.nav-burger {
    display: none;
    flex: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 40px; height: 40px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}
.nav-burger span {
    display: block;
    width: 18px; height: 2px;
    background: var(--ink);
    border-radius: 1px;
    transition: transform .18s ease, opacity .18s ease;
}
.nav-burger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger.is-open span:nth-child(2) { opacity: 0; }
.nav-burger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.site-nav { display: flex; flex: 1 1 auto; flex-wrap: wrap; gap: 2px 22px; }

.nav-item { position: relative; }
.nav-item > a,
.nav-item > .nav-btn,
.nav-item > .nav-dead { display: block; padding: 6px 0; font-size: 15px; }
.nav-item:hover > a,
.nav-item.is-active > a,
.nav-item:hover > .nav-btn,
.nav-item.is-active > .nav-btn { color: var(--brand-2); }
.nav-item.is-active > a,
.nav-item.is-active > .nav-btn { font-weight: 600; }

/* 有子栏目的项渲染成按钮：点击展开，不跳转 */
.nav-btn,
.side-btn {
    border: 0; background: none; padding: 6px 0; margin: 0;
    font: inherit; font-size: 15px; color: inherit; cursor: pointer; text-align: left;
}
.nav-btn.is-open { color: var(--brand-2); }

/* 既没子栏目也没文章的项：不可点 */
/* 不可点的栏目（既没文章也没子栏目）。
   用普通箭头而不是默认光标：<span> 默认是文本选择光标（I 形），
   看着像能选字，实际上什么都点不了，容易被当成 bug。 */
.nav-dead { color: var(--ink); cursor: default; }

.nav-sub {
    position: absolute; top: 100%; left: -14px; z-index: 20;
    display: none; min-width: 170px; padding: 8px;
    background: #fff; border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.nav-sub.is-open { display: block; }
.nav-sub a,
.nav-sub .nav-dead { display: block; padding: 7px 10px; font-size: 14px; color: var(--ink-2); border-radius: 6px; }
.nav-sub a:hover { background: var(--bg-2); color: var(--brand-2); }

/* ---------------------------------------------------------------- 轮播 */

.hero {
    position: relative; margin-bottom: 40px;
    border-radius: var(--radius); overflow: hidden; background: var(--bg-2);
}
.hero-slide img { width: 100%; height: clamp(220px, 38vw, 460px); object-fit: cover; }
.hero-slide.is-on { animation: hero-in .5s ease; }
@keyframes hero-in { from { opacity: .4; } to { opacity: 1; } }

.hero-dots {
    position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
    display: flex; gap: 9px;
}
.hero-dot {
    width: 9px; height: 9px; padding: 0; border: 0; border-radius: 50%;
    background: rgba(255, 255, 255, .55); cursor: pointer;
}
.hero-dot.is-on { background: #fff; }

/* ---------------------------------------------------------------- 栏目块与卡片 */

.block { margin-bottom: 46px; }

.block-head {
    display: flex; align-items: baseline; justify-content: space-between;
    margin-bottom: 18px; padding-bottom: 12px; border-bottom: 2px solid var(--line);
}
.block-title { margin: 0; font-size: 22px; letter-spacing: .3px; }
.block-title::before {
    content: ""; display: inline-block; width: 4px; height: 18px; margin-right: 10px;
    vertical-align: -2px; border-radius: 2px; background: var(--brand-2);
}

.more { font-size: 14px; color: var(--accent); }
.more::after { content: " ›"; }
.more:hover { text-decoration: underline; }

.cards { display: grid; gap: 22px; grid-template-columns: repeat(4, 1fr); }
.cards-3 { grid-template-columns: repeat(3, 1fr); }
.cards-4 { grid-template-columns: repeat(4, 1fr); }

.card {
    display: flex; flex-direction: column;
    border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
    background: #fff; transition: box-shadow .18s, transform .18s, border-color .18s;
}
.card:hover { border-color: #cfe0ea; box-shadow: var(--shadow); transform: translateY(-2px); }

.card-thumb { aspect-ratio: 4 / 3; background: var(--bg-2); overflow: hidden; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }

.card-title {
    margin: 14px 16px 0; font-size: 16px; line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-excerpt {
    margin: 8px 16px 16px; font-size: 13.5px; line-height: 1.7; color: var(--ink-2);
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---------------------------------------------------------------- 页面标题 */

.page-head { margin: 6px 0 26px; }
.page-title { margin: 0; font-size: 26px; }
.page-sub { margin: 8px 0 0; font-size: 14px; color: var(--ink-2); }

.page-banner { margin-bottom: 26px; border-radius: var(--radius); overflow: hidden; }
.page-banner img { width: 100%; height: clamp(180px, 28vw, 340px); object-fit: cover; }

.empty { padding: 60px 0; text-align: center; color: var(--ink-3); }

/* ---------------------------------------------------------------- 文章页 */


/* 左栏目树 + 右正文。正文宽度由 grid 兜住，超宽屏上也不会拉成一行字 */
.with-side {
    display: grid; grid-template-columns: 220px minmax(0, 1fr);
    gap: 40px; align-items: start;
}

.side { position: sticky; top: 20px; }
.side-title {
    padding-bottom: 10px; font-size: 15px; font-weight: 600;
    border-bottom: 2px solid var(--line);
}
.side-nav { margin-top: 10px; }
.side-group > a,
.side-group > .side-btn,
.side-group > .side-dead { display: block; padding: 7px 0; font-size: 15px; cursor: default; }
.side-group.is-active > a,
.side-group.is-active > .side-btn { color: var(--brand-2); font-weight: 600; }
.side-btn { width: 100%; padding: 7px 0; }

/* 子栏目默认收起，点一下才展开 */
.side-children { display: none; padding-left: 12px; }
.side-children.is-open { display: block; }
.side-children a,
.side-children .side-dead { display: block; padding: 5px 0; font-size: 14px; color: var(--ink-2); cursor: default; }
.side-children a:hover,
.side-children a.is-active { color: var(--brand-2); }
.side-children a.is-active { font-weight: 600; }

.article-nav {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-top: 44px; padding-top: 22px; border-top: 1px solid var(--line);
}
.article-nav-btn { font-size: 14px; color: var(--brand-2); }
.article-nav-btn.is-off { color: var(--ink-3); }
.article-nav-btn.back { color: var(--ink-2); }
.article-nav-btn:hover { text-decoration: underline; }

/* 列表页那块用一份浅底，跟文章页区分开 */
.about .prose { color: var(--ink-2); }

/* ---------------------------------------------------------------- 分页 */

.pager {
    display: flex; align-items: center; justify-content: center; gap: 18px;
    margin: 44px 0 0;
}
.pager-btn {
    padding: 8px 20px; font-size: 14px; border: 1px solid var(--line); border-radius: 999px;
}
.pager-btn:hover { border-color: var(--brand-2); color: var(--brand-2); }
.pager-btn.is-off { color: var(--ink-3); }
.pager-info { font-size: 14px; color: var(--ink-2); }

/* ---------------------------------------------------------------- 页脚 */

/* 页脚：上面一条蓝底放联系方式，下面一条浅底放版权和备案号 */
.site-foot { margin-top: 48px; }

.foot-main {
    background: linear-gradient(135deg, #12709f, #0c5480);
    color: #fff;
    padding: 30px 0;
}
.foot-inner {
    display: flex; align-items: center; justify-content: center;
    flex-wrap: wrap; gap: 20px 26px;
}
.foot-tel { flex: none; height: 64px; width: auto; }
.foot-slogan {
    margin: 0; font-size: 14.5px; line-height: 1.95;
    color: #e8f3fa;
}

.foot-bar { background: var(--bg-2); border-top: 1px solid var(--line); padding: 15px 0; }
.foot-copy { margin: 0; font-size: 13.5px; color: var(--ink-2); text-align: center; }

/* ---------------------------------------------------------------- 窄屏 */

@media (max-width: 1000px) {
    .cards { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
    /* 窄屏顶部导航已经够用，侧栏那块栏目树收起来 */
    .with-side { grid-template-columns: 1fr; gap: 24px; }
    .side { position: static; }
    .side-nav { display: none; }
}

@media (max-width: 1000px) {
    /* 导航收进汉堡：头部第一行只放 logo、语言切换和汉堡按钮。
       **flex-wrap 不能少**：导航展开时是 flex-basis: 100%，容器不换行的话
       它会跟 logo、语言挤在同一行被压扁。 */
    .head-bar { flex-wrap: wrap; gap: 6px 16px; padding: 12px 0; min-height: 0; }
    .brand img { max-height: 38px; }
    .lang { margin-left: auto; }
    .nav-burger { display: flex; }

    /* 搜索框在 DOM 里排在最后，这里让它独占头部最后一行 */
    .site-search { flex-basis: 100%; }
    .site-search-input { flex: 1 1 auto; width: auto; }

    /* 默认收起，点汉堡才展开 */
    .site-nav { display: none; flex-basis: 100%; flex-direction: column; gap: 0; }
    .site-nav.is-open { display: flex; }

    /* 竖排时每一项占一整行，用上边框分隔 */
    .nav-item { border-top: 1px solid var(--line); }
    .nav-item > a,
    .nav-item > .nav-btn,
    .nav-item > .nav-dead { padding: 12px 2px; }

    /* 子栏目不做绝对定位的下拉，直接铺在父项下面 */
    .nav-sub {
        position: static;
        min-width: 0;
        padding: 0 0 8px 14px;
        border: 0;
        box-shadow: none;
        background: none;
    }
    .nav-sub a,
    .nav-sub .nav-dead { padding: 9px 2px; }
}

@media (max-width: 760px) {
    .cards, .cards-3, .cards-4 { grid-template-columns: repeat(2, 1fr); gap: 14px; }
    .card-title { font-size: 15px; margin: 11px 12px 0; }
    .card-excerpt { margin: 6px 12px 13px; -webkit-line-clamp: 2; }
    .article-title { font-size: 23px; }
    .prose { font-size: 16px; line-height: 1.9; }
    /* 页脚窄屏竖排：图标 + 电话图一行，描述另起一行 */
    .foot-inner { flex-direction: column; gap: 14px; }
    .foot-tel { height: 54px; }
    .foot-slogan { text-align: center; font-size: 13.5px; }
}

@media (max-width: 460px) {
    .cards, .cards-3, .cards-4 { grid-template-columns: 1fr; }

    /* 更窄的机器（小屏手机）把头部再收一点，保证 logo、语言、汉堡能并排放下 */
    .brand { font-size: 18px; }
    .brand img { max-height: 32px; }
    .lang { font-size: 13px; padding: 4px 11px; }
    .nav-burger { width: 36px; height: 36px; }
}

/* ---------------------------------------------------------------- 在线客服 */
/* 这里的变量只能用 portal.css 自己定义的那套（--ink / --line / --bg-2 / --brand / --radius），
   admin.css 里的 --gray-* 和 --radius-lg 在前台不存在——用了不会报错，
   只是整条声明失效，气泡会变成"白底 + 无色边框"，在白页面上的白气泡就是看不见。 */
.chat-page {
    max-width: 760px;
    margin: 0 auto;
    padding: 24px 20px 40px;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 160px);
}
.chat-head { margin-bottom: 16px; }
.chat-head h1 { font-size: 22px; margin: 0 0 6px; color: var(--ink); }
.chat-head-hint { margin: 0; color: var(--ink-2); font-size: 14px; }

.chat-stream {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    min-height: 380px;
    max-height: calc(100vh - 320px);
}
.chat-empty { color: var(--ink-3); font-size: 14px; text-align: center; padding: 48px 0; }

.chat-row { display: flex; margin-bottom: 12px; }
.chat-row-visitor { justify-content: flex-start; }
.chat-row-staff { justify-content: flex-end; }

.chat-bubble {
    max-width: 76%;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 15px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}
.chat-row-visitor .chat-bubble {
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line);
}
.chat-row-staff .chat-bubble {
    background: var(--brand);
    color: #fff;
    border: 1px solid var(--brand);
}

.chat-compose {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    align-items: flex-end;
}
.chat-compose textarea {
    flex: 1;
    min-width: 0;
    height: 48px;
    resize: none;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: 15px;
    line-height: 1.5;
}
.chat-compose textarea::placeholder { color: var(--ink-3); }
.chat-compose textarea:focus { outline: none; border-color: var(--brand-2); }

/* 前台没有全局 .btn 定义（那是后台的），这里单独给聊天窗的发送按钮上样式，
   不然是个浏览器默认按钮，跟输入框对不上。 */
.chat-compose .btn {
    flex: none;
    height: 48px;
    padding: 0 22px;
    border: 0;
    border-radius: var(--radius);
    background: var(--brand);
    color: #fff;
    font: inherit;
    font-size: 15px;
    cursor: pointer;
}
.chat-compose .btn:hover { background: var(--brand-2); }
.chat-compose .btn:disabled { opacity: .55; cursor: default; }

.chat-error {
    margin-top: 10px;
    padding: 9px 13px;
    border-radius: var(--radius);
    background: #fdf2f2;
    border: 1px solid #f5c2c2;
    color: #b42318;
    font-size: 13px;
}

/* 在线客服入口：右下角悬浮。所有前台页面都有（加在 portal/foot 里）。
   手机上只留图标，省地方。 */
.chat-fab {
    position: fixed;
    right: 20px;
    bottom: 24px;
    z-index: 60;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--brand, #1a73e8);
    color: #fff;
    border-radius: 999px;
    box-shadow: 0 6px 20px rgba(16, 24, 40, .22);
    font-size: 14px;
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease;
}
.chat-fab:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(16, 24, 40, .28); }
.chat-fab svg { flex: none; }

@media (max-width: 640px) {
    .chat-fab { right: 14px; bottom: 16px; padding: 12px; }
    .chat-fab-text { display: none; }
}
