/* ==========================================================================
   Cases 页面样式（cases.html 专用）
   说明：颜色 / 字号 / 间距 / 缓动等变量统一复用 style.css 的 :root，
        这里只写「案例」页独有的版块：Banner、面包屑、案例九宫格、分页。
   ========================================================================== */


/* ==========================================================================
   01. 页面 Banner（全幅实拍背景 + 居中 CASES 标题，导航透明压在图上方）
   ========================================================================== */

.cases-hero {
    position: relative;
    overflow: hidden;
    /* 上提一个导航高度，让透明导航叠在 Banner 图上（与首页 hero、关于我们同一手法） */
    margin-top: calc(-1 * var(--header-h));
    /* 深色兜底：图片未加载时不露白 */
    background-color: #cfd0d2;
}


/* 背景图：四边外扩，给视差留出位移余量 */

.cases-hero__bg {
    position: absolute;
    inset: -8% 0;
    background-image: url("../images/cases-hero.jpg");
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    will-change: transform;
}

.cases-hero__inner {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* 设计稿 Banner 高度 549px（1920 宽），等比缩放 */
    height: clamp(340px, 28.6vw, 550px);
    /* 顶部让出导航高度，标题在导航之下的区域垂直居中 */
    padding-top: var(--header-h);
}

.cases-hero__title {
    /* 设计稿标题字高约 34px，对应字号约 46px */
    font-size: clamp(28px, 2.4vw, 46px);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-white);
    text-shadow: 0 2px 24px rgba(0, 0, 0, 0.32);
    /* 首屏加载入场：淡入 + 轻微上浮 */
    animation: cases-hero-in var(--dur-slow) var(--ease) both;
}


/* 标题下的白色短线 */

.cases-hero__title::after {
    content: "";
    display: block;
    width: 66px;
    height: 4px;
    margin: 18px auto 0;
    background-color: var(--color-white);
    animation: cases-line-in var(--dur-slow) var(--ease) 0.18s both;
}

@keyframes cases-hero-in {
    from {
        opacity: 0;
        transform: translateY(22px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes cases-line-in {
    from {
        opacity: 0;
        transform: scaleX(0.2);
    }

    to {
        opacity: 1;
        transform: scaleX(1);
    }
}


/* ==========================================================================
   02. 面包屑（本页设计为纯文字 Home - Cases，没有房子图标）
   ========================================================================== */

.cases-breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
    /* 顶部与 Banner 留出 40px 呼吸（1920 宽） */
    padding-top: clamp(20px, 2.1vw, 40px);
    font-size: var(--fs-desc);
    line-height: 1.4;
    color: var(--color-text-muted);
}

.cases-breadcrumb__link {
    color: var(--color-text-muted);
    transition: color 0.35s var(--ease);
}

.cases-breadcrumb__link:hover {
    color: var(--color-primary);
}

.cases-breadcrumb__sep {
    color: var(--color-text-muted);
}

.cases-breadcrumb__current {
    color: var(--color-text-muted);
}


/* ==========================================================================
   03. 案例列表（大标题 + 三列卡片网格 + 分页）
   ========================================================================== */

.cases-list {
    /* 面包屑到标题、分页到 Contact 之间的留白由各元素自身的 margin 控制 */
    padding-bottom: clamp(48px, 6vw, 120px);
}

.cases-title {
    /* 设计稿字高 34px、位于 y=681 */
    margin: clamp(26px, 3.7vw, 70px) 0 clamp(30px, 5.2vw, 100px);
    font-size: clamp(28px, 2.4vw, 46px);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--color-ink);
}

.cases-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    /* 列间距 ≈ 96px、行间距 ≈ 64px（1920 宽的设计值） */
    column-gap: clamp(18px, 5vw, 96px);
    row-gap: clamp(18px, 3.4vw, 64px);
}


/* --- 单张卡片 --- */

.case-tile {
    /* 入场动画的错峰延迟（数据由 CSS 按列循环给出，避免内联样式） */
    --reveal-delay: 0ms;
    position: relative;
}

.cases-grid .case-tile:nth-child(3n+2) {
    --reveal-delay: 90ms;
}

.cases-grid .case-tile:nth-child(3n) {
    --reveal-delay: 180ms;
}

/*
   视觉主体放在内层链接上：
   - 卡片本体带 [data-reveal]，其 transform 由入场动画接管，
     把 hover 位移写在内层可避免两条规则争抢同一个属性
   - 圆角 / 裁切 / 阴影同样交给内层，抬起时不会被外层裁掉
*/

.case-tile__link {
    display: block;
    position: relative;
    /* 设计稿卡片 502×366，用比例锁死高度 */
    aspect-ratio: 502 / 366;
    overflow: hidden;
    border-radius: var(--radius-sm);
    background-color: #1b1b1e;
    transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.case-tile__media {
    position: absolute;
    inset: 0;
    display: block;
    overflow: hidden;
}

.case-tile__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform var(--dur-slow) var(--ease);
}


/* 底部深色渐变字幕条 */

.case-tile__caption {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    padding: clamp(28px, 2.4vw, 42px) clamp(14px, 1.2vw, 22px) clamp(14px, 1.1vw, 20px);
    /* 自下而上由实到虚，保证照片主体不受压暗 */
    background-image: linear-gradient(to top, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.58) 22%, rgba(0, 0, 0, 0.16) 62%, rgba(0, 0, 0, 0) 100%);
}

.case-tile__name {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    /* 设计稿字幕折成两行（第一行到 Kang 结束），宽度约卡片一半 */
    max-width: 47%;
    margin: 0;
    font-size: clamp(12px, 0.82vw, 16px);
    font-weight: 500;
    line-height: 1.5;
    color: var(--color-white);
}

/* 行首的红色小圆点（设计稿用「•」引出地名） */

.case-tile__dot {
    flex: none;
    width: 5px;
    height: 5px;
    margin-top: 0.62em;
    border-radius: 50%;
    background-color: var(--color-white);
}

/* 右下角红色圆形箭头 */

.case-tile__arrow {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(38px, 2.7vw, 52px);
    height: clamp(38px, 2.7vw, 52px);
    border-radius: 50%;
    background-color: var(--color-primary);
    transition: background-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.case-tile__arrow svg {
    width: 46%;
    height: 46%;
    stroke: var(--color-white);
    stroke-width: 2;
    stroke-linecap: round;
    fill: none;
    transition: stroke var(--dur-fast) var(--ease);
}


/* hover：卡片轻微抬起、图片缓推、箭头反色 */

.case-tile:hover .case-tile__link,
.case-tile__link:focus-visible {
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.18);
    transform: translateY(-6px);
}

.case-tile:hover .case-tile__img {
    transform: scale(1.06);
}

.case-tile__link:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.case-tile:hover .case-tile__arrow {
    background-color: var(--color-primary-dark);
    transform: scale(1.06);
}


/* ==========================================================================
   04. 分页（ul.pagination，右对齐并距容器右边缘约 100px，结构同 {$pages} 输出）
   ========================================================================== */

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: clamp(8px, 1.1vw, 20px);
    /* 设计稿分页整体右移，距右侧约 102px */
    margin: clamp(30px, 3.8vw, 72px) 0 0;
    padding: 0 clamp(0px, 5.3vw, 102px) 0 0;
    font-size: clamp(15px, 0.94vw, 18px);
    line-height: 1;
    list-style: none;
}

.pagination li {
    display: flex;
    align-items: center;
}

.pagination li a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.6em;
    padding: 6px 2px;
    font-family: inherit;
    font-size: inherit;
    font-weight: 500;
    color: var(--color-text);
    text-decoration: none;
    cursor: pointer;
    transition: color var(--dur-fast) var(--ease);
}

.pagination li a:hover {
    color: var(--color-primary);
}

/* 当前页：设计稿用红色文字（不加底框） */

.pagination li.active a {
    font-weight: 700;
    color: var(--color-primary);
}

.pagination li a:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
}


/* ==========================================================================
   05. 响应式适配
   ========================================================================== */

/* 笔记本：卡片两列 */
@media (max-width: 1024px) {
    .cases-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: clamp(16px, 3vw, 40px);
        row-gap: clamp(16px, 3vw, 40px);
    }

    .cases-grid .case-tile:nth-child(3n+2),
    .cases-grid .case-tile:nth-child(3n) {
        --reveal-delay: 0ms;
    }

    .cases-grid .case-tile:nth-child(2n) {
        --reveal-delay: 90ms;
    }

    .pagination {
        justify-content: center;
        padding-right: 0;
    }
}

/* 平板：Banner 更矮，标题字号收紧 */
@media (max-width: 768px) {
    .cases-hero__inner {
        height: clamp(280px, 38vw, 360px);
    }

    .cases-hero__title {
        font-size: clamp(24px, 5vw, 32px);
    }

    .cases-hero__title::after {
        width: 52px;
        height: 3px;
        margin-top: 14px;
    }

    .cases-title {
        margin-bottom: clamp(22px, 5vw, 36px);
    }

    .case-tile__name {
        max-width: 58%;
    }

    .pagination {
        flex-wrap: wrap;
        row-gap: 6px;
    }
}

/* 手机：单列 */
@media (max-width: 620px) {
    .cases-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .cases-grid .case-tile:nth-child(2n) {
        --reveal-delay: 0ms;
    }

    .case-tile__link {
        aspect-ratio: 4 / 3;
    }

    .case-tile__caption {
        padding-top: 36px;
    }

    .case-tile__name {
        max-width: 62%;
    }
}


/* ==========================================================================
   06. 减少动态效果偏好：关闭入场位移与图片缓推
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .cases-hero__title,
    .cases-hero__title::after {
        animation: none;
    }

    .case-tile__link,
    .case-tile__img {
        transition: none;
    }

    .case-tile:hover .case-tile__link {
        transform: none;
    }

    .case-tile:hover .case-tile__img {
        transform: none;
    }
}
