/* ==========================================================================
   AIPO 全站基础样式 (Step 1)
   - CSS 变量（颜色 / 字体 / 字号阶梯）
   - reset
   - 工具类（来自 layouts/main.php，已展开 @apply 为纯 CSS）
   后续步骤会逐步把各页面共享的组件样式（.container/.eyebrow/.btn 等）
   合并进来，并清理各页面 <style> 块中的重复定义。
   ========================================================================== */

:root {
    /* 品牌色 */
    --brand:        #a91f29;
    --brand-deep:   #77180D;
    --brand-tint:   #FCEFEF;

    /* 文字色 */
    --ink:    #1A1A1A;   /* 主文字 */
    --ink-2:  #4B4F58;   /* 次文字 */
    --ink-3:  #8A8A8A;   /* 弱化文字 */
    --line:   #E8E6E1;
    --line-2: #DCD9D1;

    /* 底色 */
    --paper:   #FFFFFF;
    --paper-2: #FAF8F4;
    --paper-3: #F4F1EA;
    --night:   #1A1416;
    --night-2: #2A2125;

    /* 字体 */
    --serif: 'Noto Serif SC', 'Songti SC', 'STSong', serif;
    --sans:  'Inter', 'Noto Sans SC', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;

    /* 字号阶梯（min 14px，7档） */
    --fs-xs:  14px;                          /* 注解 / caption / eyebrow */
    --fs-sm:  16px;                          /* 正文 / 按钮 / 列表 */
    --fs-md:  18px;                          /* 副标题 / hero lead / h6 */
    --fs-lg:  20px;                          /* h5 / 卡片标题 */
    --fs-xl:  24px;                          /* h4 / h3 */
    --fs-2xl: 32px;                          /* h2 / section-title */
    --fs-3xl: clamp(36px, 6vw, 56px);        /* h1 / hero title */

    /* 旧变量名兼容（页面里在用） */
    --brand-primary: var(--brand);
}

/* ============ Reset & 基础排版 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--sans);
    color: var(--ink);
    background: var(--paper);
    line-height: 1.7;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; height: auto; }


/* ============ 工具类（来自 main.php，已展开 @apply） ============ */
.content-auto      { content-visibility: auto; }
.text-shadow       { text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3); }
.bg-gradient       { background: linear-gradient(135deg, #000 0%, #4b4f58 100%); }
.transition-custom { transition: all 0.3s ease-in-out; }

/* .nav-scrolled = bg-white + shadow-md */
.nav-scrolled {
    background-color: #fff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

/* .card-hover = transition-all 300 + hover:shadow-xl + hover:-translate-y-1 */
.card-hover { transition: all 0.3s ease; }
.card-hover:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    transform: translateY(-4px);
}

/* ============ Slider 组件 ============ */
.slider-container { position: relative; overflow: hidden; }
.slider-wrapper   { display: flex; transition: transform 0.5s ease-in-out; }
.slider-item      { min-width: 100%; flex-shrink: 0; }
.slider-nav       { display: flex; justify-content: center; gap: 0.75rem; margin-top: 2rem; }
.slider-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    background-color: #e5e7eb;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
.slider-dot.active { background-color: var(--brand); }
.slider-btn {
    position: absolute; top: 50%;
    transform: translateY(-50%);
    background-color: rgba(169, 31, 41, 0.8);
    color: #fff; border: none;
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-radius: 0.375rem;
    z-index: 10;
    transition: background-color 0.3s ease;
    font-size: var(--fs-sm);
}
.slider-btn:hover { background-color: var(--brand); }
.slider-btn.prev  { left: 1rem; }
.slider-btn.next  { right: 1rem; }

/* ============ 分页 ============ */
.pagination {
    display: flex;
    justify-content: center;
    padding-left: 0;
    list-style: none;
    border-radius: 0.375rem;
}
.pagination .page-item { margin: 0 0.25rem; }
.pagination .page-link {
    position: relative; display: block;
    padding: 0.5rem 0.75rem;
    margin-left: -1px;
    line-height: 1.5;
    color: var(--ink-2);
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
    text-decoration: none;
}
.pagination .page-link:hover {
    color: var(--brand);
    background-color: #f8f9fa;
    border-color: #dee2e6;
}
.pagination .page-item.active .page-link {
    color: #fff;
    background-color: var(--brand);
    border-color: var(--brand);
}
.pagination .page-link:focus {
    z-index: 3;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(169, 31, 41, 0.25);
}
.pagination input[type="text"] {
    width: 45px; margin: 0; padding: 0;
    text-align: center;
    border: 0;
    font-size: var(--fs-xs);
    font-weight: 500;
    color: var(--brand);
}
.pagination input[type="text"]:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(169, 31, 41, 0.2);
    border-radius: 0.25rem;
}

/* ============ 导航下拉图片边框 ============ */
.nav-dropdown-img {
    position: relative;
    border-left: 10px solid #000;
    border-top:  10px solid #000;
    transition: all 0.3s ease;
}
.nav-dropdown-img:hover {
    border-left-color: var(--brand);
    border-top-color:  var(--brand);
}

/* ============ 顶部导航（来自 layouts/main.php 内联 <style>） ============ */
header a.bg-primary,
header a.bg-primary:visited,
header a.bg-primary:active {
    color: #fff !important;
}

/* 深色半透明 + 毛玻璃：下方正文被糊掉，不干扰阅读；白色导航文字始终有足够对比度。
   background-image:none 用来盖掉 layouts/main.php <header> 上的 inline 黑色渐变
   （那条渐变底部收到全透明，正是正文透出来的原因）。 */
#navbar{
    background-color: rgba(0, 0, 0, .85) !important;
    background-image: none !important;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    opacity: 1;
}
/* 滚动后只加深一点并补投影，仍保持深色——不能变白，否则 text-white 的导航文字会消失。
   特异性 (1,1,0) 高于 .nav-scrolled，用来压过首页动态注入的那条白底规则。 */
#navbar.nav-scrolled{
    background-color: rgba(0, 0, 0, .92) !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}
/* 导航 logo 边缘磨砂柔光：沿 SVG 实际形状半透明羽化，避免与背景产生硬边 */
#navbar .nav-logo {
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.35))
            drop-shadow(0 0 8px rgba(255, 255, 255, 0.15));
}

/* ===== 多级导航（最多四级）hover 展开，纯 CSS，不依赖 Tailwind group ===== */
#navbar .nav-has-sub{ position:relative; }
#navbar .nav-sub{
    position:absolute; min-width:14rem;
    opacity:0; visibility:hidden; pointer-events:none;
    transition:opacity .2s ease, visibility .2s ease;
    z-index:50;
}
/* 悬停触发项本身、或已展开的子菜单时，保持子菜单可见 */
#navbar .nav-has-sub:hover > .nav-sub,
#navbar .nav-sub:hover{ opacity:1; visibility:visible; pointer-events:auto; }
/* 二级：紧贴顶级项正下方展开 */
#navbar .nav-sub--drop{ top:100%; left:0; }
/* 三、四级：从父项右侧飞出 */
#navbar .nav-sub--flyout{ top:0; left:100%; }
/* 深层子菜单若靠近右边缘，改向左侧飞出（给容器加 .nav-flip-left 生效） */
#navbar .nav-flip-left > .nav-sub--flyout{ left:auto; right:100%; }
/* 透明"悬停桥"：填补触发项与子菜单之间的间隙，滑动时不丢失 hover */
#navbar .nav-sub::before{ content:""; position:absolute; }
#navbar .nav-sub--drop::before{ left:0; right:0; top:-0.7rem; height:0.7rem; }
#navbar .nav-sub--flyout::before{ top:0; bottom:0; left:-0.7rem; width:0.7rem; }
#navbar .nav-flip-left > .nav-sub--flyout::before{ left:auto; right:-0.7rem; }


/* ==========================================================================
   移动端全局适配（≤768px）
   只在窄屏生效，桌面版样式完全不受影响。
   各页面专属的移动端调整仍写在各自的 /assets/css/<page>.css 里。
   ========================================================================== */
@media (max-width: 768px) {

    /* 兜底：局部元素溢出时不产生整页横向滚动。
       用 clip 而不是 hidden —— hidden 会让 body 变成滚动容器，
       从而破坏页面里的 position:sticky（目录、吸顶栏等）。 */
    html, body { overflow-x: clip; }

    /* 媒体元素不撑破容器 */
    img, video, iframe, canvas, embed, object { max-width: 100%; }
    video, iframe { height: auto; }

    /* 长英文单词 / URL 强制换行，避免撑破卡片 */
    h1, h2, h3, h4, h5, h6,
    p, li, dd, dt, td, th, blockquote, figcaption {
        overflow-wrap: break-word;
        word-break: break-word;
    }

    /* 宽表格改成可横向滑动的区块，不再把页面撑宽 */
    table {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* 代码块横向滚动 */
    pre { overflow-x: auto; }

    /* 返回顶部按钮：缩小并靠边，避免遮挡正文与客服浮窗 */
    #back-to-top {
        width: 2.75rem;
        height: 2.75rem;
        right: 1rem;
        bottom: 1.25rem;
    }

    /* 页脚订阅表单：邮箱输入框在窄屏不被按钮挤压 */
    #footer-form input[type="email"] { min-width: 0; }

    /* 分页条在窄屏换行显示 */
    .pagination { flex-wrap: wrap; row-gap: 0.5rem; }
}


/* ==========================================================================
   顶部导航断点（汉堡菜单 ↔ 桌面横排）
   一级导航共 7 项（含 登录 / 联系我们），加上 220px 的 logo 与容器留白，
   整行至少需要约 920px；原来的 md(768px) 断点在平板上会把导航文字挤到换行。
   layouts/main.php 已改用 lg(1024px) 切换，这里补两条配套规则。
   ========================================================================== */

/* 汉堡菜单展开后项目可能超过一屏，给它一个滚动上限（与 lg 断点对齐） */
@media (max-width: 1023px) {
    #mobile-menu {
        max-height: calc(100vh - 4.5rem);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* 在窄屏展开过汉堡菜单后旋转/放大到桌面宽度时，菜单会残留在导航条下方，
   桌面宽度下强制收起（此时汉堡按钮本身已隐藏，无法再手动关闭）。 */
@media (min-width: 1024px) {
    #mobile-menu { display: none !important; }
}