/* ==========================================================================
   通利动漫站复刻主题
   --------------------------------------------------------------------------
   说明: 目标站是 wds168.cn 的模块化建站系统, 页面由带随机模块号的 div 拼装,
   直接复用它的全部 CSS 需要按原样复刻每一层模块 DOM 且依赖 <head> 里
   200 多个样式文件的加载顺序, 很难稳定还原。
   因此这里按"信息架构 + 品牌视觉一致"的原则自建一套响应式主题:
     - 品牌主色 #b22222(取自原站), 字体/字号层级贴近原站
     - 全部使用 Bootstrap 3 栅格, 移动优先, 不写死像素宽度
     - 内容(文字/图片/附件)完全来自数据库, 由爬虫抓取的原站数据渲染
   ========================================================================== */

:root {
    --brand: #b22222;
    --brand-dark: #8d1a1a;
    --text: #333;
    --text-muted: #666;
    --border: #e5e5e5;
    --bg-soft: #f7f7f7;
}

body {
    font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: #fff;
    padding-top: 0;
}

a { color: var(--text); }
a:hover, a:focus { color: var(--brand); text-decoration: none; }

/* ---------- 头部: logo + 导航 + 搜索 + 语言, 同一水平线 ---------- */
.tl-header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
}

.tl-header-row {
    display: flex;
    align-items: center;
}

/**
 * logo 相对默认位置左移(约 3cm; 96dpi 下 3cm ≈ 113px)
 *
 * 页头内容本来被居中的 .container 框住, 直接给固定负边距会在窄屏把 logo 顶出屏幕。
 * 这里用 max() 取"想要的位移"和"实际可用的左侧空间"中的较小值:
 *   可用空间 = 50vw - 50%  (视口左边缘到 logo 默认位置的距离)
 * 于是宽屏下最多左移 113px, 窄屏下最多贴到视口边(再留 10px 呼吸位), 永不被裁掉。
 * 想调距离改 -113px 即可(3cm→113px / 2cm→76px / 1cm→38px)。
 *
 * 注意: 负边距只作用在 flex 行的首项上, 它后面的 .tl-header-main 用 flex:1 撑满,
 * 所以 logo 向左探出的同时, 右侧的搜索/语言仍贴住 container 右边缘。
 */
.tl-header .tl-logo {
    flex: 0 0 auto;
    display: inline-block;
    /* +20px 而不是 +10px: vw 含滚动条宽度(~15px), 会让实际留白少一半, 多给一点余量 */
    margin-left: max(-113px, calc(50% - 50vw + 20px));
}
.tl-header .tl-logo img { max-height: 56px; max-width: 100%; }
.tl-header .tl-brand-text {
    font-size: 22px;
    font-weight: 700;
    color: var(--brand);
    line-height: 1.2;
}

/* 导航 + 工具区(占满 logo 右侧剩余宽度) */
.tl-header-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1 1 auto;
    min-width: 0;
    margin-left: 28px;
}

/* ---------- 主导航 ---------- */
.tl-menu {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}
.tl-menu > li { position: relative; }
.tl-menu > li > a {
    position: relative;
    display: block;
    padding: 0 18px;
    line-height: 76px;
    font-size: 15px;
    color: var(--text);
    white-space: nowrap;
}
.tl-menu > li > a:hover,
.tl-menu > li.active > a { color: var(--brand); }

/* 当前项: 文字下方的红色短横线(宽度随文字, 与原站一致) */
.tl-menu > li.active > a:after {
    content: "";
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 20px;
    height: 3px;
    background: var(--brand);
}

.tl-menu .dropdown-menu {
    border-radius: 0;
    border-top: 2px solid var(--brand);
    margin-top: 0;
}
.tl-menu .dropdown-menu > li > a { padding: 8px 20px; }
.tl-menu .dropdown-menu > li > a:hover { background: var(--bg-soft); color: var(--brand); }

/* 桌面端二级菜单用 hover 展开(原站就是 hover 交互) */
@media (min-width: 992px) {
    .tl-menu > li.dropdown:hover > .dropdown-menu { display: block; }
}

/* ---------- 搜索(圆角胶囊) ---------- */
.tl-header-tools {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}
.tl-search {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 4px 8px 4px 16px;
    border: 1px solid #dcdcdc;
    border-radius: 999px;
}
.tl-search-scope { position: relative; display: inline-flex; align-items: center; }
.tl-search-scope select {
    border: 0;
    outline: 0;
    background: transparent;
    padding: 0 16px 0 0;
    font-size: 14px;
    color: var(--text);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
}
/* 下拉指示三角(原生的箭头在去样式后会消失, 这里补一个) */
.tl-search-scope:after {
    content: "";
    position: absolute;
    right: 4px;
    top: 50%;
    margin-top: -2px;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid #999;
    pointer-events: none;
}
.tl-search-input {
    border: 0;
    outline: 0;
    background: transparent;
    width: 132px;
    padding: 0 8px;
    font-size: 14px;
    color: var(--text);
}
.tl-search-input::placeholder { color: #aaa; }
.tl-search-btn {
    border: 0;
    outline: 0;
    background: transparent;
    padding: 0 4px;
    font-size: 16px;
    line-height: 1;
    color: #999;
}
.tl-search-btn:hover { color: var(--brand); }

/* ---------- 语言切换 ---------- */
.tl-lang {
    display: flex;
    align-items: center;
    margin-left: 22px;
    font-size: 14px;
    white-space: nowrap;
}
.tl-lang-en { color: var(--text); }
.tl-lang-en:hover { color: var(--brand); }
.tl-lang-sep { margin: 0 6px; color: #ccc; }
.tl-lang-current { color: var(--brand); }

/* ---------- 窄屏折叠开关 ---------- */
.tl-nav-toggle {
    display: none;
    margin-left: auto;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: #fff;
}
.tl-nav-toggle .icon-bar {
    display: block;
    width: 20px;
    height: 2px;
    margin-top: 4px;
    background: var(--text);
}
.tl-nav-toggle .icon-bar:first-child { margin-top: 0; }

/* ---------- 窄屏(<992px): 导航与工具收进折叠面板 ---------- */
@media (max-width: 991px) {
    .tl-header-row { flex-wrap: wrap; }
    .tl-header-main {
        display: none;
        flex: 1 0 100%;
        flex-direction: column;
        align-items: stretch;
        margin-left: 0;
        padding-top: 12px;
    }
    .tl-header-main.open { display: flex; }

    .tl-menu { flex-direction: column; align-items: stretch; }
    .tl-menu > li > a {
        padding: 12px 4px;
        line-height: 1.4;
        border-bottom: 1px solid var(--border);
    }
    .tl-menu > li.active > a:after { display: none; }

    /* 二级菜单在窄屏收起来, 由 JS 点父项展开 */
    .tl-menu .dropdown-menu {
        display: none;
        position: static;
        float: none;
        border: 0;
        border-top: 0;
        box-shadow: none;
        background: var(--bg-soft);
    }
    .tl-menu .dropdown.open > .dropdown-menu { display: block; }
    /* 父项右侧的展开指示 */
    .tl-menu > li.dropdown > a:after {
        content: "\f107"; /* fa-angle-down */
        font-family: FontAwesome;
        position: absolute;
        right: 6px;
        top: 50%;
        margin-top: -7px;
        height: auto;
        background: none;
        color: #999;
    }

    .tl-header-tools { flex-direction: column; align-items: stretch; margin-top: 14px; }
    .tl-search { border-radius: 4px; padding: 6px 10px; }
    .tl-search-input { flex: 1 1 auto; width: auto; }
    .tl-lang { margin: 14px 0 0; }
}

/* ---------- 通用区块 ---------- */
.tl-section { padding: 36px 0; }
.tl-section-soft { background: var(--bg-soft); }
.tl-section-title { text-align: center; margin: 0 0 26px; }
.tl-section-title h2 {
    font-size: 26px;
    margin: 0 0 6px;
    font-weight: 700;
    color: var(--text);
}
.tl-section-title p { color: var(--text-muted); margin: 0; font-size: 13px; }
.tl-section-title:after {
    content: "";
    display: block;
    width: 46px;
    height: 3px;
    background: var(--brand);
    margin: 14px auto 0;
}

/* ---------- 首页 Banner ---------- */
.tl-banner { position: relative; overflow: hidden; background: #111; }
.tl-banner img { width: 100%; height: auto; display: block; }
.tl-banner-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 30px 0;
    background: linear-gradient(to top, rgba(0, 0, 0, .65), rgba(0, 0, 0, 0));
    color: #fff;
}
.tl-banner-caption h1 { font-size: 28px; margin: 0 0 6px; font-weight: 700; }
.tl-banner-caption p { margin: 0; opacity: .9; }

/* ---------- 产品 ---------- */
.tl-pro-item {
    background: #fff;
    border: 1px solid var(--border);
    margin-bottom: 24px;
    transition: box-shadow .2s, transform .2s;
}
.tl-pro-item:hover { box-shadow: 0 6px 18px rgba(0, 0, 0, .1); transform: translateY(-2px); }
.tl-pro-thumb {
    display: block;
    position: relative;
    padding-top: 75%;
    overflow: hidden;
    background: var(--bg-soft);
}
.tl-pro-thumb img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: contain;
}
.tl-pro-name {
    padding: 12px 10px;
    text-align: center;
    font-size: 14px;
    border-top: 1px solid var(--border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tl-pro-item:hover .tl-pro-name { color: var(--brand); }

/* ---------- 分类侧栏 ---------- */
.tl-side { margin-bottom: 24px; }
.tl-side-title {
    background: var(--brand);
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    padding: 12px 18px;
}
.tl-side-list { border: 1px solid var(--border); border-top: 0; }
.tl-side-list li { border-bottom: 1px solid var(--border); }
.tl-side-list li:last-child { border-bottom: 0; }
.tl-side-list li a {
    display: block;
    padding: 12px 18px;
    font-size: 14px;
}
.tl-side-list li a:hover, .tl-side-list li.active a {
    background: var(--bg-soft);
    color: var(--brand);
    border-left: 3px solid var(--brand);
    padding-left: 15px;
}

/* ---------- 面包屑 ---------- */
.tl-crumb {
    background: var(--bg-soft);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    font-size: 13px;
    color: var(--text-muted);
}
.tl-crumb a { color: var(--text-muted); }
.tl-crumb a:hover { color: var(--brand); }

/* ---------- 详情 ---------- */
.tl-detail-title { font-size: 22px; margin: 0 0 14px; font-weight: 700; }
.tl-detail-meta {
    color: var(--text-muted);
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    margin-bottom: 18px;
}
.tl-detail-meta span { margin-right: 18px; }
.tl-content { line-height: 1.9; font-size: 15px; word-wrap: break-word; }
.tl-content img { max-width: 100% !important; height: auto !important; }
.tl-content table { width: 100%; max-width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.tl-content table td, .tl-content table th { border: 1px solid var(--border); padding: 8px; }

/* 产品图集 */
.tl-gallery-main {
    border: 1px solid var(--border);
    padding: 10px;
    text-align: center;
    margin-bottom: 10px;
}
.tl-gallery-main img { max-width: 100%; max-height: 420px; }
.tl-gallery-thumbs img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border: 1px solid var(--border);
    margin: 0 8px 8px 0;
    cursor: pointer;
    padding: 2px;
}
.tl-gallery-thumbs img:hover, .tl-gallery-thumbs img.active { border-color: var(--brand); }

/* ---------- 新闻 ---------- */
.tl-news-item {
    border-bottom: 1px dashed var(--border);
    padding: 18px 0;
}
.tl-news-item:last-child { border-bottom: 0; }
.tl-news-item h4 { margin: 0 0 8px; font-size: 17px; font-weight: 700; }
.tl-news-item h4 a:hover { color: var(--brand); }
.tl-news-item .tl-news-date { color: var(--text-muted); font-size: 13px; }
.tl-news-item .tl-news-desc { color: var(--text-muted); font-size: 14px; margin: 8px 0 0; }
.tl-news-img img { width: 100%; height: auto; }

/* ---------- 下载表格 ---------- */
.tl-down-table { width: 100%; border: 1px solid var(--border); }
.tl-down-table thead th {
    background: var(--bg-soft);
    padding: 12px;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.tl-down-table tbody td { padding: 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
.tl-down-table tbody tr:hover { background: #fcfcfc; }
.tl-down-btn {
    display: inline-block;
    background: var(--brand);
    color: #fff !important;
    padding: 10px 26px;
    font-size: 15px;
}
.tl-down-btn:hover { background: var(--brand-dark); color: #fff !important; }

/* ---------- 分页 ---------- */
.tl-pager { text-align: center; padding: 26px 0; }
.tl-pager .pagination { margin: 0; }
.tl-pager .pagination > .active > a,
.tl-pager .pagination > .active > span {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
.tl-pager .pagination > li > a, .tl-pager .pagination > li > span { color: var(--text); }

/* ---------- 页脚 ---------- */
.tl-footer { background: #2b2b2b; color: #bbb; padding: 36px 0 0; font-size: 13px; }
.tl-footer h4 { color: #fff; font-size: 15px; margin: 0 0 14px; }
.tl-footer a { color: #bbb; }
.tl-footer a:hover { color: #fff; }
.tl-footer .tl-footer-list li { margin-bottom: 8px; }
.tl-footer .tl-footer-bottom {
    border-top: 1px solid #3d3d3d;
    margin-top: 26px;
    padding: 16px 0;
    text-align: center;
    color: #888;
}

/* ---------- 空状态 ---------- */
.tl-empty { text-align: center; color: var(--text-muted); padding: 60px 0; }

/* ---------- 移动端 ---------- */
@media (max-width: 767px) {
    /* logo 在手机上同样靠左(与 PC 端一致), 只把销售热线居中 */
    .tl-header .tl-logo { display: inline-block; }
    .tl-header .tl-brand-sub { text-align: left; }
    .tl-header .tl-hotline { text-align: center; padding-top: 8px; }
    .tl-section { padding: 22px 0; }
    .tl-section-title h2 { font-size: 20px; }
    .tl-banner-caption { padding: 16px 0; }
    .tl-banner-caption h1 { font-size: 18px; }
    .tl-detail-title { font-size: 18px; }
    .tl-content { font-size: 14px; }
    .tl-down-table thead th:nth-child(3),
    .tl-down-table tbody td:nth-child(3) { display: none; }
    .tl-gallery-thumbs img { width: 56px; height: 56px; }
}
