:root {
    --thm-base-rgb: 45, 118, 192;
    --product-card-desktop-min-height: 560px;
    --product-card-feature-row-height: 28px;
}

/* Product Card Improvements for /products page and category pages */

.atf-single-team.atf-product-card {
    background-color: var(--color-white);
    border: 1px solid #e9ecef;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(20, 41, 108, 0.08);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--thm-black);
}

/* 产品卡片由 Isotope 绝对定位布局，单纯 `height: 100%` 无法让同行卡片互相等高。
 * 这里先让网格项本身成为 flex 承托，再给桌面端卡片统一最小高度，
 * 解决“有参数标签/无参数标签、单按钮/双按钮”造成的首屏卡片高度不一致。
 */
.atf-portfolio-grid .grid-item {
    display: flex;
}

.atf-portfolio-grid .grid-item > .atf-single-team.atf-product-card {
    width: 100%;
    min-height: var(--product-card-desktop-min-height);
}

.atf-single-team.atf-product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--navv2-outer-shadow);
    border-color: var(--thm-base);
}

.atf-team-pic {position: relative;
    overflow: hidden;
    background: var(--color-white);
    /* 产品卡图片区按视觉规范保持纯净底板，不再叠加内阴影背景。 */
    box-shadow: none;
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px;
    border-radius: 12px;
    margin-bottom: 5px;
}

.atf-team-pic img {
    position: relative;
    overflow: hidden;
    /*background: var(--color-white);*/
    /*box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05); !* Subtle inner shadow *!*/
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px;
    border-radius: 12px;
    margin-bottom: 5px;
}

.atf-team-pic picture {
    width: auto;
    max-width: 90%;
    height: auto;
    max-height: 85%;
    object-fit: contain;
    /* 产品列表卡片只保留轻微放大，避免 1.3 倍造成主体跳动和裁切感。 */
    transition: transform 0.3s ease;
}

.atf-single-team.atf-product-card:hover .atf-team-pic img {
    width: auto;
    max-width: 90%;
    height: auto;
    max-height: 85%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.atf-single-team.atf-product-card:hover .atf-team-pic picture{
    transform: scale(1.05);
}

.atf-product-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--thm-base);
    color: var(--color-white);
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    z-index: 2;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Dynamic Badge Colors */
.atf-product-badge[data-category="filter1"] {
    background-color: #2e86c1;
}

/* Deep Sky */
.atf-product-badge[data-category="filter3"] {
    background-color: #e67e22;
}

/* Planetary */
.atf-product-badge[data-category="filter4"] {
    background-color: #27ae60;
}

/* Guide */
.atf-product-badge[data-category="filter5"] {
    background-color: #8e44ad;
}

/* Accessories: avoid gray because gray is reserved for discontinued status badges. */
.atf-product-badge[data-category="filter6"] {
    background-color: var(--v2-primary-700);
    color: var(--v2-text-inverse);
}

/* Accessories */
.atf-product-badge[data-category="filter7"] {
    background-color: #c0392b;
}

/* Smart Controllers */
.atf-product-badge[data-category="filter8"] {
    background-color: #2c3e50;
}

/* Telescopes */

/* 停产产品属于业务状态标签，不应继续套用 Guide/Accessory 等分类颜色。
 * 这里使用 root.css 中的灰色文字语义变量作为背景，确保产品中心、
 * 分类列表和详情页 Related 卡片的停产状态保持一致。
 */
.atf-product-badge[data-product-status="unavailable"],
.atf-product-badge[data-badge-label="Discontinued"] {
    background-color: var(--v2-text-secondary);
    color: var(--v2-text-inverse);
}

.atf-team-prof {
    padding: 0 20px 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-card-content {
    /* 内容区改为纵向弹性布局，便于统一标题、标签和按钮区的垂直节奏。 */
    flex-grow: 1; /* This will push the actions to the bottom */
    display: flex;
    flex-direction: column;
}

h4.atf-team-title {
    display: block !important; /* Ensure title is always visible */
    font-size: 1.1rem; /* Slightly smaller to fit better */
    font-weight: 700;
    margin-top: 15px;
    margin-bottom: 12px;
    line-height: var(--v2-h4-line-height);
    /* 标题区固定为两行高度，避免一行标题和两行标题把同一行卡片撑成不同高度。 */
    height: calc(var(--v2-h4-line-height) * 2);
    min-height: calc(var(--v2-h4-line-height) * 2);
}

h4.atf-team-title a {
    color: var(--thm-black);
    text-decoration: none;
    transition: color 0.2s ease;
    /* 将标题限制在两行内，既保证可读性，也保证卡片网格纵向对齐。 */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.atf-single-team.atf-product-card:hover h4.atf-team-title a {
    color: var(--thm-base);
}

.atf-product-features {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    /* 桌面端统一预留三行标签高度。
     * 相机通常有 Sensor / Sensor Format / Sensor Area / USB 四个标签，窄卡片下可能换到三行；
     * 配件、望远镜没有标签时也保留同样空间，保证同一行卡片按钮基线一致。
     */
    min-height: calc(var(--product-card-feature-row-height) * 3 + 16px);
    align-content: flex-start;
}

.feature-tag {
    background: var(--thm-f6);
    color: var(--thm-base);
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid rgba(var(--thm-base-rgb), 0.2);
}

.atf-product-actions {
    margin-top: 15px; /* Space between features/title and buttons */
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* 固定按钮区最小高度，并让单按钮卡片也贴底对齐到统一基线。 */
    min-height: calc(var(--v2-button-height, 44px) * 2 + 8px); /* 预留双按钮高度，单按钮也贴底对齐。 */
    justify-content: flex-end;
}

/* 产品中心卡片按钮与首页 banner 统一为主次按钮语义：
 * - Buy Now：镂空按钮
 * - View Details：实心按钮
 * - 只有一个按钮时默认视为详情按钮，保持实心样式
 */
.atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--v2-spacing-xs, 4px);
    width: 100%;
    min-height: var(--v2-button-height, 44px);
    padding: 0 18px;
    /* 产品卡主次按钮统一按新版 44 高按钮圆角实现。 */
    border-radius: var(--v2-radius-button-pill, 22px);
    border: 1px solid transparent;
    font-size: var(--v2-font-size-base, 16px);
    font-weight: 600;
    line-height: var(--v2-line-height-base, 24px);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn i,
.atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn span {
    display: inline-flex;
    align-items: center;
    align-self: center;
}

.atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn:only-child,
.atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn:last-child {
    background-color: var(--v2-primary-500, #2967D3);
    color: var(--v2-text-inverse, #FFFFFF);
    border-color: var(--v2-primary-500, #2967D3);
    box-shadow: var(--v2-shadow-card, 0 8px 24px rgba(41, 103, 211, 0.12));
}

.atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn:only-child:hover,
.atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn:last-child:hover {
    background-color: var(--v2-primary-400, #4F89E0);
    color: var(--v2-text-inverse, #FFFFFF);
    border-color: var(--v2-primary-400, #4F89E0);
    box-shadow: var(--v2-shadow-card-hover, 0 12px 28px rgba(41, 103, 211, 0.18));
    transform: translateY(-2px);
}

.atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn:only-child:active,
.atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn:last-child:active {
    background-color: var(--v2-primary-600, #184AAD);
    border-color: var(--v2-primary-600, #184AAD);
    transform: translateY(0);
    box-shadow: none;
}

.atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn:first-child:not(:only-child) {
    background: transparent;
    color: var(--v2-primary-500, #2967D3);
    border-color: rgba(var(--v2-primary-500-rgb, 41, 103, 211), 0.32);
    box-shadow: none;
}

.atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn:first-child:not(:only-child):hover {
    background: rgba(var(--v2-primary-500-rgb, 41, 103, 211), 0.05);
    color: var(--v2-primary-600, #184AAD);
    border-color: var(--v2-primary-500, #2967D3);
    transform: translateY(-2px);
}

.atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn:first-child:not(:only-child):active {
    background: rgba(var(--v2-primary-500-rgb, 41, 103, 211), 0.10);
    color: var(--v2-primary-600, #184AAD);
    border-color: var(--v2-primary-600, #184AAD);
    transform: translateY(0);
}

/* --- Portfolio Filter Button Improvements --- */
.atf-portfolio-area .portfolio-filter {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 40px !important;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.atf-portfolio-area .portfolio-filter::-webkit-scrollbar {
    display: none;
}

.atf-portfolio-area .portfolio-filter button {
    background: var(--color-white);
    color: var(--thm-base);
    padding: 10px 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    line-height: 1.2;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
    margin: 0;
    border-radius: 0;
    border-right-width: 0;
}

.atf-portfolio-area .portfolio-filter button:first-child {
    border-top-left-radius: 999px;
    border-bottom-left-radius: 999px;
}

.atf-portfolio-area .portfolio-filter button:last-child {
    border-top-right-radius: 999px;
    border-bottom-right-radius: 999px;
    border-right-width: 1px;
}

/* 未激活按钮的鼠标悬浮只保留轻提示，避免与真正的激活态混淆 */
.atf-portfolio-area .portfolio-filter button:not(.active):hover {
    border-color: rgba(var(--thm-base-rgb), 0.35);
    color: var(--thm-base);
    background-color: var(--color-white);
    transform: none;
    box-shadow: none;
}

.atf-portfolio-area .portfolio-filter button.active {
    background: var(--thm-line);
    color: var(--color-white);
    border-color: var(--thm-base);
    box-shadow: 0 8px 25px rgba(45, 118, 192, 0.25);
    transform: none;
    z-index: 1; /* Ensure active button is on top */
}

/* 激活按钮在 hover/focus 下继续保持唯一主态视觉 */
.atf-portfolio-area .portfolio-filter button.active:hover,
.atf-portfolio-area .portfolio-filter button.active:focus {
    color: var(--color-white);
    background: var(--thm-line);
    filter: brightness(1.1);
}

/* 鼠标点击不再触发接近激活态的 focus 样式，仅保留键盘可访问性焦点 */
.atf-portfolio-area .portfolio-filter button:focus {
    outline: none;
}

.atf-portfolio-area .portfolio-filter button:focus-visible {
    outline: 2px solid var(--thm-base);
    outline-offset: 3px;
    box-shadow: none;
    z-index: 2; /* Ensure focus outline is on top */
}

/* 移动端卡片样式适配 */
@media (max-width: 991px) {
    .atf-team-prof{
        padding: 0 20px;
    }

    /* 移动端卡片宽度更窄，不再强制两行标题占位，避免留下过大空白。 */
    h4.atf-team-title {
        min-height: auto;
    }

    h4.atf-team-title a {
        -webkit-line-clamp: 3;
    }

    /* 移动端标签允许自然换行，高度不再强制锁定。 */
    .atf-product-features {
        min-height: auto;
    }

    .atf-product-actions{
        min-height:39px;
        height: auto;
        flex-direction: row;
        justify-content: flex-start;
    }
    .atf-themes-btn{
        padding: 15px;
    }

    .atf-single-team .atf-team-pic img, .atf-single-team .atf-team-pic picture{
        height:100%;
        width: auto;
    }

    .atf-single-team .atf-team-pic picture img,.atf-single-team .atf-team-pic img{
        height:100%;
        width: auto;
    }
    .atf-team-pic img{
        background:transparent;

    }
    .atf-single-team.atf-product-card{

    }
}

@media screen and (max-width: 576px) {
    .atf-single-team .atf-team-pic {
        height: auto;
    }
}

/* ============================================================
   Global V2 Product Card Overrides
   说明：
   - 产品中心、分类页和部分列表页共用这套卡片语言。
   - 这里统一圆角、阴影、按钮和筛选器，不再保留旧版渐变 pill 与裸 rgba 阴影。
   ============================================================ */

.atf-single-team.atf-product-card {
    background-color: var(--v2-bg-primary);
    border: 1px solid var(--v2-bg-divider);
    border-radius: var(--v2-radius-sm);
    box-shadow: var(--v2-shadow-card);
    color: var(--v2-text-heading);
    min-height: var(--product-card-desktop-min-height);
}

.atf-single-team.atf-product-card:hover {
    border-color: var(--v2-primary-200);
    box-shadow: var(--v2-shadow-card-hover);
    transform: translateY(-4px);
}

/*
 * 分类页和产品中心的实际卡片结构使用 `.atf-single-team.atf-product-card`
 * + `.atf-team-pic` / `.atf-team-prof` / `.atf-product-actions`。
 * 旧版 `style.css` 中存在更早定义的图片区渐变背景，这里使用更窄且更强的选择器，
 * 明确把媒体区和内容区背景统一回视觉规范的语义 token，避免继续显示旧渐变。
 */
.atf-single-team.atf-product-card > .atf-team-pic {
    background-image: none;
    background-color: var(--v2-bg-functional);
    border-radius: var(--v2-radius-sm);
    /* 产品中心图片区不再使用额外高光或内阴影，保持平整背景面。 */
    box-shadow: none;
}

.atf-single-team.atf-product-card > .atf-team-pic img,
.atf-single-team.atf-product-card > .atf-team-pic picture img {
    border-radius: var(--v2-radius-sm);
}

.atf-single-team.atf-product-card:hover > .atf-team-pic picture {
    /* 使用轻微放大作为卡片 hover 的统一视觉反馈。 */
    transform: scale(1.05);
}

/*
 * 内容区保持主卡白底，和页面功能底形成清晰层级。
 * 这里显式声明背景，避免页面级旧规则只改媒体区、不改正文区时产生视觉断层。
 */
.atf-single-team.atf-product-card .atf-team-prof {
    background-color: var(--v2-bg-primary);
    padding: 0 var(--v2-card-padding) var(--v2-card-padding);
}

/*
 * 操作区和卡片主体使用同一白底语义，保证按钮区域不会继承旧的透明/渐变背景。
 */
.atf-single-team.atf-product-card .atf-product-actions {
    background-color: var(--v2-bg-primary);
}

/*
 * 产品列表页按钮需要脱离全局 `.atf-themes-btn` 共享规则。
 * 全局按钮在 `style.css` 末尾会重新把它们设为 block 并附加统一 hover/active，
 * 这会破坏卡片里“购买镂空 / 详情实心”的双按钮语义。
 * 这里用更高优先级把卡片按钮固定为独立组件，统一尺寸、对齐和交互层级。
 */
.atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn,
.atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn.d-block {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex-direction: row;
    width: 100%;
    min-height: var(--v2-button-height);
    height: var(--v2-button-height);
    padding: 0 18px;
    margin: 0;
    border-radius: var(--v2-radius-sm);
    line-height: var(--v2-line-height-base);
    text-align: center;
    text-shadow: none;
    overflow: hidden;
}

.guide-camera-list-page .atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn,
.guide-camera-list-page .atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn.d-block,
.multi-purpose-camera-list-page .atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn,
.multi-purpose-camera-list-page .atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn.d-block,
.planetary-camera-list-page .atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn,
.planetary-camera-list-page .atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn.d-block,
.accessories-list-page .atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn,
.accessories-list-page .atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn.d-block,
.product-detail-v2 .atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn,
.product-detail-v2 .atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn.d-block {
    text-transform: none;
}

/*
 * 关闭旧按钮扫光伪元素，避免在镂空按钮和实心按钮上产生额外色块或半层覆盖。
 */
.atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn::before,
.atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn.d-block::before {
    display: none;
    content: none;
}

/*
 * 图标和文本都按 flex 子项居中，避免不同图标字体造成纵向抖动。
 */
.atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn i,
.atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn span,
.atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn.d-block i,
.atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn.d-block span {
    line-height: 1;
}

/*
 * 双按钮卡片统一为一主一辅：
 * - 第一个按钮（Buy Now）使用镂空按钮
 * - 最后一个按钮（View Details）使用主按钮
 * 通过显式 box-shadow/background 重申，防止被共享按钮 hover 再次覆盖。
 */
.atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn:first-child:not(:only-child) {
    background-color: transparent;
    color: var(--v2-primary-500);
    border-color: rgba(var(--v2-primary-500-rgb), 0.32);
    box-shadow: none;
}

.atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn:last-child,
.atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn:only-child {
    background-color: var(--v2-primary-500);
    color: var(--v2-text-inverse);
    border-color: var(--v2-primary-500);
    box-shadow: var(--v2-shadow-card);
}

h4.atf-team-title,
h4.atf-team-title a {
    color: var(--v2-text-heading);
}

.atf-single-team.atf-product-card:hover h4.atf-team-title a {
    color: var(--v2-primary-500);
}

.feature-tag {
    background: var(--v2-bg-content);
    color: var(--v2-primary-500);
    border-radius: var(--v2-radius-sm, 8px);
    border: 1px solid rgba(var(--v2-primary-500-rgb), 0.12);
}

.atf-product-badge {
    background: var(--v2-primary-500);
    color: var(--v2-text-inverse);
    border-radius: var(--v2-radius-sm, 8px);
    box-shadow: var(--v2-shadow-black);
}

.atf-product-actions .atf-themes-btn {
    min-height: var(--v2-button-height);
    border-radius: var(--v2-radius-sm);
}

.atf-portfolio-area .portfolio-filter {
    gap: 10px;
    margin-bottom: 48px !important;
}

.atf-portfolio-area .portfolio-filter button {
    min-height: 44px;
    padding: 0 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--v2-radius-button-pill);
    border: 1px solid var(--v2-bg-divider);
    background: var(--v2-bg-primary);
    color: var(--v2-text-secondary);
    line-height: 1.2;
    box-shadow: none;
}

.atf-portfolio-area .portfolio-filter button:first-child,
.atf-portfolio-area .portfolio-filter button:last-child {
    border-radius: var(--v2-radius-button-pill);
}

/* V2 版本中同样收口 hover 语义，只给未激活项轻量提示 */
.atf-portfolio-area .portfolio-filter button:not(.active):hover {
    border-color: var(--v2-primary-200);
    color: var(--v2-primary-600);
    background-color: var(--v2-bg-primary);
    box-shadow: none;
}

.atf-portfolio-area .portfolio-filter button.active,
.atf-portfolio-area .portfolio-filter button.active:hover,
.atf-portfolio-area .portfolio-filter button.active:focus {
    background: var(--v2-primary-500);
    color: var(--v2-text-inverse);
    border-color: var(--v2-primary-500);
    box-shadow: var(--v2-shadow-card);
    transform: none;
    filter: none;
}

/* V2 焦点只在键盘导航时出现，避免鼠标点击后形成第二个“伪激活”按钮 */
.atf-portfolio-area .portfolio-filter button:focus {
    outline: none;
}

.atf-portfolio-area .portfolio-filter button:not(.active):focus-visible {
    border-color: var(--v2-primary-300);
    color: var(--v2-primary-600);
    outline: 2px solid rgba(var(--v2-primary-500-rgb), 0.22);
    outline-offset: 3px;
    box-shadow: none;
}

.atf-portfolio-area .portfolio-filter button.active:focus-visible {
    outline: 2px solid rgba(var(--v2-primary-500-rgb), 0.28);
    outline-offset: 3px;
}

@media (max-width: 991px) {
    .filter-button-container {
        margin-left: calc(var(--bs-gutter-x, 1.5rem) * -0.5);
        margin-right: calc(var(--bs-gutter-x, 1.5rem) * -0.5);
        overflow: hidden;
    }

    /*
     * 移动端产品分类改为页面内横向 tab。
     * 这里继续复用桌面端 data-filter 按钮，避免维护第二套筛选 DOM 或 JS 事件。
     */
    .atf-portfolio-area .portfolio-filter {
        display: flex !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start;
        gap: 34px;
        width: 100%;
        margin: 28px 0 34px !important;
        padding: 0 calc(var(--bs-gutter-x, 1.5rem) * 0.5) 4px;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
    }

    .atf-portfolio-area .portfolio-filter::-webkit-scrollbar {
        display: none;
    }

    .atf-portfolio-area .portfolio-filter button {
        position: relative;
        min-height: 48px;
        padding: 0;
        flex: 0 0 auto;
        scroll-snap-align: start;
        border: 0;
        border-radius: 0;
        background: transparent;
        color: var(--v2-text-heading);
        box-shadow: none;
        font-size: 18px;
        font-weight: 500;
        letter-spacing: 0;
    }

    .atf-portfolio-area .portfolio-filter button:first-child,
    .atf-portfolio-area .portfolio-filter button:last-child {
        border-radius: 0;
    }

    .atf-portfolio-area .portfolio-filter button::after {
        content: '';
        position: absolute;
        left: 0;
        right: 0;
        bottom: 6px;
        height: 2px;
        border-radius: var(--v2-radius-pill);
        background: transparent;
    }

    .atf-portfolio-area .portfolio-filter button:not(.active):hover,
    .atf-portfolio-area .portfolio-filter button:not(.active):focus {
        border: 0;
        background: transparent;
        color: var(--v2-text-heading);
        box-shadow: none;
    }

    .atf-portfolio-area .portfolio-filter button.active,
    .atf-portfolio-area .portfolio-filter button.active:hover,
    .atf-portfolio-area .portfolio-filter button.active:focus {
        border: 0;
        background: transparent;
        color: var(--v2-text-heading);
        box-shadow: none;
        font-weight: 700;
    }

    .atf-portfolio-area .portfolio-filter button.active::after {
        background: var(--v2-text-heading);
    }

    .atf-portfolio-area .portfolio-filter button:focus-visible {
        outline: 2px solid rgba(var(--v2-primary-500-rgb), 0.28);
        outline-offset: 3px;
    }
}

@media (max-width: 991px) {
    .atf-portfolio-grid .grid-item > .atf-single-team.atf-product-card,
    .atf-single-team.atf-product-card {
        min-height: auto;
    }

    .atf-team-prof {
        padding: 0 24px 24px;
    }

    .atf-product-features {
        min-height: auto;
    }

    .atf-product-actions {
        min-height: auto;
    }
}

/* ============================================================
   V2 卡片组件样式 - 新规范（渐进式迁移）
   使用 --v2-* 变量系统，参考 root.css 和 v2-components.css
   ============================================================ */

/**
 * V2 产品卡片 - 添加 v2-card 类名时启用新样式
 * 保持原有类名兼容，通过新增类名触发新样式
 */
.atf-single-team.atf-product-card.v2-card {
    background-color: var(--v2-bg-primary, #FFFFFF);
    border: 1px solid var(--v2-bg-divider, #E3E8F0);
    border-radius: var(--v2-radius-sm, 8px);
    box-shadow: var(--v2-shadow-card, 0 4px 12px rgba(0, 0, 0, 0.08));
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.atf-single-team.atf-product-card.v2-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--v2-shadow-card-hover, 0 12px 24px rgba(41, 103, 211, 0.15));
    border-color: var(--v2-primary-200, #A7CEFA);
}

/* V2 卡片图片容器 */
.atf-single-team.atf-product-card.v2-card .atf-team-pic {
    background: var(--v2-bg-functional, #F4F6F9);
    border-radius: var(--v2-radius-sm, 8px);
    margin: var(--v2-card-padding, 16px);
    margin-bottom: var(--v2-spacing-xs, 8px);
    /* V2 镜像卡同样移除图片区内阴影，和正式产品卡保持一致。 */
    box-shadow: none;
}

/* V2 卡片徽章 */
.atf-single-team.atf-product-card.v2-card .atf-product-badge {
    background: var(--v2-primary-500, #2967D3);
    color: var(--v2-text-primary, #FFFFFF);
    border-radius: var(--v2-radius-sm, 8px);
    padding: var(--v2-spacing-xs, 4px) var(--v2-spacing-sm, 12px);
    font-size: var(--v2-font-size-xs, 12px);
    box-shadow: 0 2px 8px rgba(41, 103, 211, 0.25);
}

/* Accessory badges must not share the gray visual language used by discontinued products. */
.atf-single-team.atf-product-card.v2-card .atf-product-badge[data-category="filter6"] {
    background-color: var(--v2-primary-700);
    color: var(--v2-text-inverse);
}

/* V2 卡片的徽章选择器优先级更高，因此停产状态需要在同一作用域下再次声明，
 * 避免未来 v2-card 变体把 Discontinued 标签覆盖回蓝色。
 */
.atf-single-team.atf-product-card.v2-card .atf-product-badge[data-product-status="unavailable"],
.atf-single-team.atf-product-card.v2-card .atf-product-badge[data-badge-label="Discontinued"] {
    background-color: var(--v2-text-secondary);
    color: var(--v2-text-inverse);
}

/* V2 卡片内容区 */
.atf-single-team.atf-product-card.v2-card .atf-team-prof {
    padding: 0 var(--v2-card-padding, 16px) var(--v2-card-padding, 16px);
}

/* V2 卡片标题 */
.atf-single-team.atf-product-card.v2-card h4.atf-team-title {
    font-size: var(--v2-h5-font-size, 18px);
    line-height: var(--v2-h5-line-height, 28px);
    margin-top: var(--v2-spacing-sm, 12px);
    margin-bottom: var(--v2-spacing-sm, 12px);
    color: var(--v2-text-primary, #182028);
}

.atf-single-team.atf-product-card.v2-card h4.atf-team-title a {
    color: var(--v2-text-primary, #182028);
}

.atf-single-team.atf-product-card.v2-card:hover h4.atf-team-title a {
    color: var(--v2-primary-500, #2967D3);
}

/* V2 特性标签 */
.atf-single-team.atf-product-card.v2-card .feature-tag {
    background: var(--v2-bg-action, #EDF2F8);
    color: var(--v2-primary-600, #1B4AA0);
    border: 1px solid rgba(var(--v2-primary-500-rgb, 41, 103, 211), 0.15);
    padding: 4px 10px;
    border-radius: var(--v2-radius-sm, 8px);
    font-size: var(--v2-font-size-xs, 11px);
}

/* V2 卡片操作区 */
.atf-single-team.atf-product-card.v2-card .atf-product-actions {
    margin-top: var(--v2-spacing-md, 16px);
    gap: var(--v2-spacing-sm, 8px);
}

/* V2 卡片按钮 */
.atf-single-team.atf-product-card.v2-card .atf-themes-btn {
    background-color: var(--v2-primary-500, #2967D3);
    color: var(--v2-text-primary, #FFFFFF);
    border-radius: var(--v2-radius-sm, 8px);
    padding: var(--v2-spacing-sm, 12px) var(--v2-spacing-md, 16px);
    font-size: var(--v2-font-size-sm, 14px);
}

.atf-single-team.atf-product-card.v2-card .atf-themes-btn:hover {
    background-color: var(--v2-primary-600, #1B4AA0);
    transform: translateY(-1px);
}

/* ============================================================
   V2 筛选按钮组样式
   ============================================================ */

.atf-portfolio-area .portfolio-filter.v2-filter button {
    background: var(--v2-bg-primary, #FFFFFF);
    color: var(--v2-text-secondary, #5A6B7C);
    padding: var(--v2-spacing-sm, 12px) var(--v2-spacing-md, 20px);
    font-size: var(--v2-font-size-base, 15px);
    border: 1px solid var(--v2-bg-divider, #E3E8F0);
    border-radius: var(--v2-radius-sm, 8px);
}

.atf-portfolio-area .portfolio-filter.v2-filter button:first-child,
.atf-portfolio-area .portfolio-filter.v2-filter button:last-child {
    border-radius: var(--v2-radius-sm, 8px);
}

.atf-portfolio-area .portfolio-filter.v2-filter button:not(.active):hover {
    border-color: var(--v2-primary-300, #79ABED);
    color: var(--v2-primary-600, #1B4AA0);
    background-color: var(--v2-bg-action, #EDF2F8);
}

.atf-portfolio-area .portfolio-filter.v2-filter button.active {
    background: var(--v2-primary-500, #2967D3);
    color: var(--v2-text-primary, #FFFFFF);
    border-color: var(--v2-primary-500, #2967D3);
}

.atf-portfolio-area .portfolio-filter.v2-filter button.active:hover,
.atf-portfolio-area .portfolio-filter.v2-filter button.active:focus {
    background: var(--v2-primary-600, #1B4AA0);
    border-color: var(--v2-primary-600, #1B4AA0);
    filter: none;
}

/* ============================================================
   V2 响应式适配
   ============================================================ */

@media (max-width: 991px) {
    .atf-single-team.atf-product-card.v2-card .atf-team-pic {
        margin: var(--v2-spacing-sm, 12px);
    }

    .atf-single-team.atf-product-card.v2-card .atf-team-prof {
        padding: 0 var(--v2-spacing-sm, 12px) var(--v2-spacing-sm, 12px);
    }

    .atf-single-team.atf-product-card.v2-card .atf-product-actions {
        flex-direction: row;
    }

    .atf-single-team.atf-product-card.v2-card .atf-themes-btn {
        padding: var(--v2-spacing-sm, 10px) var(--v2-spacing-sm, 12px);
        font-size: var(--v2-font-size-sm, 13px);
    }
}

@media screen and (max-width: 576px) {
    .atf-single-team.atf-product-card.v2-card .atf-team-pic {
        height: auto;
        min-height: 180px;
    }
}

/* ============================================================
   Mobile Portfolio Filter Edge Masks
   说明：
   - 产品中心和相机列表在移动端使用横向滚动筛选条；
   - 左右渐隐蒙版提示可横向滚动，同时左侧安全留白避免首个按钮贴边；
   - 仅作用于产品筛选容器，不影响教程、用户评测等其它筛选组件。
   ============================================================ */
@media (max-width: 991px) {
    .filter-button-container {
        --product-filter-edge-mask-width: clamp(30px, 10vw, 58px);
        --product-filter-side-gutter: clamp(28px, 8vw, 48px);
        position: relative;
        overflow: hidden;
    }

    .filter-button-container::before,
    .filter-button-container::after {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        width: var(--product-filter-edge-mask-width);
        pointer-events: none;
        z-index: 3;
    }

    .filter-button-container::before {
        left: 0;
        background: linear-gradient(
            90deg,
            var(--v2-bg-functional) 0%,
            rgba(var(--v2-bg-functional-rgb, 244, 246, 249), 0.92) 38%,
            rgba(var(--v2-bg-functional-rgb, 244, 246, 249), 0) 100%
        );
    }

    .filter-button-container::after {
        right: 0;
        background: linear-gradient(
            270deg,
            var(--v2-bg-functional) 0%,
            rgba(var(--v2-bg-functional-rgb, 244, 246, 249), 0.92) 38%,
            rgba(var(--v2-bg-functional-rgb, 244, 246, 249), 0) 100%
        );
    }

    .filter-button-container .portfolio-filter {
        padding-left: var(--product-filter-side-gutter) !important;
        padding-right: var(--product-filter-side-gutter) !important;
        scroll-padding-left: var(--product-filter-side-gutter);
        scroll-padding-right: var(--product-filter-side-gutter);
    }
}

/* ============================================================
   Products Mobile Layout Fixes
   说明：
   - 产品中心移动端会被桌面端介绍区、Bootstrap 栅格和 Isotope 共同影响；
   - 这里只收口产品列表区域，避免搜索框、介绍文案和卡片网格在窄屏出现横向溢出；
   - 详情页 Related 卡片仍使用同一张卡片样式，但不会命中产品中心介绍区规则。
   ============================================================ */
@media (max-width: 767px) {
    .atf-portfolio-area.atf-section-padding {
        padding-top: clamp(56px, 12vw, 72px);
    }

    .atf-portfolio-area > .container {
        max-width: 100%;
        overflow-x: hidden;
    }

    .atf-portfolio-area .row.align-items-center {
        gap: var(--v2-spacing-md);
    }

    .atf-portfolio-area .atf-section-title {
        margin-bottom: 0;
    }

    .atf-portfolio-area .atf-section-title h2 {
        font-size: clamp(var(--v2-h3-font-size), 8vw, var(--v2-h2-font-size));
        line-height: 1.14;
    }

    .atf-portfolio-area .atf-section-title.border-left {
        padding-left: 0 !important;
        border-left: 0 !important;
    }

    .atf-portfolio-area .atf-section-title.border-left p {
        max-width: 100%;
        margin: 0;
        color: var(--v2-text-body);
        font-size: var(--v2-font-size-lg);
        line-height: 1.7;
    }

    /* Isotope 初始化时会读取 `.grid-item` 宽度；移动端必须显式覆盖为单列，
     * 否则旧栅格可能按 25% 左偏移排布，导致页面横向溢出和卡片重叠。
     */
    .atf-portfolio-grid .grid-item {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }
}

@media (max-width: 575px) {
    .atf-portfolio-area .portfolio-filter {
        gap: clamp(24px, 8vw, 34px);
    }

    .atf-portfolio-area .portfolio-filter button {
        font-size: clamp(16px, 5.2vw, 22px);
    }
}

/* ============================================================
   Products Mobile Compact Spacing
   说明：
   - `/products` 移动端首屏下方原本继续继承桌面端 90px 区块留白和 `mt-5` 间距；
   - 这些规则只在窄屏产品列表区域压缩介绍区、筛选条和网格入口，不改变桌面端布局；
   - 间距、字体和颜色继续引用 root.css 的 V2 token，避免出现独立色值体系。
   ============================================================ */
@media (max-width: 767px) {
    .atf-portfolio-area.atf-section-padding.bg-f6 {
        padding-top: var(--v2-spacing-xl, 32px) !important;
        padding-bottom: var(--v2-spacing-2xl, 48px) !important;
    }

    .atf-portfolio-area > .container {
        padding-left: var(--v2-spacing-md, 16px);
        padding-right: var(--v2-spacing-md, 16px);
    }

    .atf-portfolio-area .row.align-items-center {
        --bs-gutter-y: 0;
        gap: 0;
        margin-bottom: var(--v2-spacing-lg, 24px);
    }

    .atf-portfolio-area .row.align-items-center > [class*="col-"] {
        margin-bottom: 0 !important;
    }

    .atf-portfolio-area .atf-section-title {
        margin-bottom: 0 !important;
    }

    .atf-portfolio-area .atf-section-title .atf-sheading {
        display: inline-flex;
        align-items: center;
        min-height: 34px;
        margin-bottom: var(--v2-spacing-sm, 10px);
        padding: 6px 12px;
        font-size: clamp(15px, 4.4vw, 18px);
        line-height: 1.1;
        border-radius: var(--v2-radius-sm, 8px);
    }

    .atf-portfolio-area .atf-section-title h2 {
        margin: 0;
        font-size: clamp(30px, 8.2vw, 38px);
        line-height: 1.08;
    }

    .atf-portfolio-area .atf-section-title.border-left {
        margin-top: var(--v2-spacing-md, 16px);
        padding-left: 0 !important;
        border-left: 0 !important;
    }

    .atf-portfolio-area .atf-section-title.border-left p {
        max-width: 100%;
        margin: 0;
        color: var(--v2-text-body);
        font-size: clamp(17px, 4.6vw, 20px);
        line-height: 1.5;
    }

    .filter-button-container {
        margin-top: var(--v2-spacing-md, 16px);
        margin-bottom: var(--v2-spacing-md, 16px);
    }

    .filter-button-container .portfolio-filter.mt-5,
    .atf-portfolio-area .portfolio-filter {
        min-height: auto;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        padding-top: 0;
        padding-bottom: var(--v2-spacing-xs, 6px);
    }

    .atf-portfolio-grid.mt-5 {
        margin-top: var(--v2-spacing-md, 16px) !important;
    }
}

@media (max-width: 575px) {
    .atf-portfolio-area .portfolio-filter {
        gap: clamp(22px, 7vw, 30px);
    }

    .atf-portfolio-area .portfolio-filter button {
        min-height: 42px;
        font-size: clamp(18px, 5vw, 21px);
        line-height: 1.15;
    }
}

/* ============================================================
   Mobile Product Card Carousel
   说明：
   - 产品列表移动端改为 Apple Shop 类似的横向卡片轨道；
   - 只在小屏启用，桌面端继续使用原有网格/Isotope；
   - 卡片右侧露出下一张的一部分，并提供左右圆形切换按钮，避免用户无限向下滚动。
   ============================================================ */
.product-mobile-carousel-shell {
    position: relative;
}

.product-mobile-carousel-controls {
    display: none;
}

@media (max-width: 767px) {
    .product-mobile-carousel-shell {
        margin-left: calc(var(--v2-mobile-container-padding, 16px) * -1);
        margin-right: calc(var(--v2-mobile-container-padding, 16px) * -1);
        overflow: hidden;
    }

    .product-mobile-carousel-track {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: stretch;
        gap: var(--v2-mobile-card-gap, 16px);
        width: 100%;
        height: auto !important;
        min-height: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding: 0 var(--v2-mobile-container-padding, 16px) var(--v2-spacing-md, 16px);
        overflow-x: auto;
        overflow-y: visible;
        scroll-snap-type: x mandatory;
        scroll-padding-left: var(--v2-mobile-container-padding, 16px);
        -webkit-overflow-scrolling: touch;
    }

    .product-mobile-carousel-track::-webkit-scrollbar {
        display: none;
    }

    .product-mobile-carousel-track > .grid-item {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        transform: none !important;
        display: flex !important;
        flex: 0 0 min(86vw, 380px) !important;
        width: min(86vw, 380px) !important;
        max-width: min(86vw, 380px) !important;
        min-width: min(86vw, 380px) !important;
        margin: 0 !important;
        padding: 0 !important;
        scroll-snap-align: start;
    }

    .product-mobile-carousel-track > .grid-item.is-mobile-hidden {
        display: none !important;
    }

    .product-mobile-carousel-track .atf-single-team.atf-product-card {
        width: 100%;
        min-height: 0;
    }

    .product-mobile-carousel-controls {
        display: block;
        pointer-events: none;
    }

    .product-mobile-carousel-btn {
        position: absolute;
        top: 50%;
        z-index: 6;
        width: 52px;
        height: 52px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 1px solid var(--v2-bg-divider);
        border-radius: var(--v2-radius-pill);
        background: color-mix(in srgb, var(--v2-bg-primary) 88%, transparent);
        color: var(--v2-text-body);
        box-shadow: var(--v2-shadow-card);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        pointer-events: auto;
        transform: translateY(-50%);
        transition: opacity 0.2s ease, color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
    }

    .product-mobile-carousel-btn.is-prev {
        left: var(--v2-mobile-container-padding, 16px);
    }

    .product-mobile-carousel-btn.is-next {
        right: var(--v2-mobile-container-padding, 16px);
    }

    .product-mobile-carousel-btn i {
        font-size: var(--v2-font-size-lg, 18px);
        line-height: 1;
    }

    .product-mobile-carousel-btn:not(:disabled):hover,
    .product-mobile-carousel-btn:not(:disabled):focus-visible {
        color: var(--v2-text-inverse);
        border-color: var(--v2-primary-500);
        background: var(--v2-primary-500);
    }

    .product-mobile-carousel-btn:disabled {
        opacity: 0.28;
        cursor: default;
    }

    .product-mobile-carousel-shell:not(.has-overflow) .product-mobile-carousel-controls {
        display: none;
    }
}

/* Product listing visual alignment */
@media (min-width: 992px) {
    .atf-portfolio-area .portfolio-filter {
        justify-content: center;
        flex-wrap: wrap;
        gap: 12px;
        overflow: visible;
    }

    .atf-portfolio-area .portfolio-filter button,
    .atf-portfolio-area .portfolio-filter button:first-child,
    .atf-portfolio-area .portfolio-filter button:last-child {
        border-right-width: 1px;
        border-radius: 8px;
        font-size: 16px;
        line-height: 24px;
        font-weight: 600;
    }
}

@media (max-width: 767px) {
    .atf-portfolio-area .portfolio-filter button,
    .atf-portfolio-area .portfolio-filter button:first-child,
    .atf-portfolio-area .portfolio-filter button:last-child {
        border-right-width: 1px;
        border-radius: 8px;
        font-size: 16px;
        line-height: 24px;
        font-weight: 600;
    }

    .filter-button-container .portfolio-filter button,
    .filter-button-container .portfolio-filter button:first-child,
    .filter-button-container .portfolio-filter button:last-child {
        padding-inline: 18px;
    }

    .filter-button-container .portfolio-filter button::after {
        content: none;
        display: none;
    }

    .atf-portfolio-area .portfolio-filter button.active,
    .atf-portfolio-area .portfolio-filter button.active:hover,
    .atf-portfolio-area .portfolio-filter button.active:focus {
        color: var(--v2-text-inverse);
        background: var(--v2-primary-500);
        box-shadow: var(--v2-shadow-sm);
    }
}

.atf-portfolio-area ~ .atf-Subscribe-area .atf-subscribe-panel,
.atf-portfolio-area ~ .atf-Subscribe-area .atf-subscribe-form,
.atf-portfolio-area ~ .atf-Subscribe-area .atf-subscribe-input,
.atf-portfolio-area ~ .atf-Subscribe-area .atf-subscribe-btn {
    border-radius: 8px;
}

.atf-portfolio-area ~ .atf-Subscribe-area .atf-subscribe-copy h3 {
    font-size: 24px;
    line-height: 32px;
    font-weight: 500;
}

@media (max-width: 767px) {
    .atf-portfolio-area ~ .atf-Subscribe-area .atf-subscribe-copy h3 {
        font-size: 20px;
        line-height: 28px;
        font-weight: 500;
    }
}

.atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn,
.atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn.d-block,
.atf-single-team.atf-product-card.v2-card .atf-themes-btn,
.atf-portfolio-area .portfolio-filter button,
.atf-portfolio-area .portfolio-filter button:first-child,
.atf-portfolio-area .portfolio-filter button:last-child {
    border-radius: var(--v2-radius-button-pill, 22px) !important;
}

@media (max-width: 767px) {
    .atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn,
    .atf-single-team.atf-product-card .atf-product-actions .atf-themes-btn.d-block,
    .atf-single-team.atf-product-card.v2-card .atf-themes-btn,
    .atf-portfolio-area .portfolio-filter button,
    .atf-portfolio-area .portfolio-filter button:first-child,
    .atf-portfolio-area .portfolio-filter button:last-child {
        border-radius: 21px !important;
    }

    .product-list-page .grid-item.is-mobile-hidden {
        display: none !important;
    }

    .product-list-page .grid-item {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        display: flex !important;
        flex: 0 0 100% !important;
        width: 100% !important;
        max-width: 100% !important;
        transform: none !important;
    }

    .product-list-page .atf-single-team.atf-product-card {
        width: 100%;
        height: auto;
        min-height: 0;
    }

    .product-list-page .atf-single-team.atf-product-card > .atf-team-pic,
    .product-list-page .atf-single-team.atf-product-card.v2-card > .atf-team-pic {
        height: clamp(260px, 72vw, 320px);
        min-height: 0;
        overflow: hidden;
    }

    .product-list-page .atf-single-team.atf-product-card > .atf-team-pic picture {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        margin: 0;
        transform: none;
        transform-origin: center;
    }

    .product-list-page .atf-single-team.atf-product-card > .atf-team-pic > img,
    .product-list-page .atf-single-team.atf-product-card > .atf-team-pic picture img {
        width: auto;
        max-width: 100%;
        height: auto;
        max-height: 100%;
        margin: 0;
        object-fit: contain;
    }

    .product-list-page .atf-single-team.atf-product-card:hover > .atf-team-pic picture {
        transform: none;
    }

    .product-list-page .product-card-content {
        flex-grow: 0;
    }

    .product-list-page h4.atf-team-title {
        height: auto;
        min-height: 0;
        margin-top: 12px;
        margin-bottom: 10px;
    }

    .product-list-page .atf-product-features {
        min-height: 0;
    }

    .product-list-page .atf-product-actions {
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 10px;
        min-height: 0;
        margin-top: 16px;
    }

    .product-list-page .atf-product-actions .atf-themes-btn,
    .product-list-page .atf-product-actions .atf-themes-btn.d-block {
        flex: 0 0 auto;
        width: 100%;
        min-width: 0;
        min-height: 44px;
        padding-inline: 16px;
        font-size: var(--v2-font-size-sm, 14px);
        white-space: nowrap;
    }

    body.product-list-page.multi-purpose-camera-list-page .atf-page-heading.atf-align-left:not(:has(.banner-center-btn)):not(:has(.btn-banner-center)):not(:has(#buy_btn)) .atf-post-label {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        width: 100%;
        max-width: 100%;
        height: 42px;
        min-height: 42px;
        padding: 0 14px;
        gap: 0;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    body.product-list-page.multi-purpose-camera-list-page .atf-page-heading.atf-align-left:not(:has(.banner-center-btn)):not(:has(.btn-banner-center)):not(:has(#buy_btn)) .atf-post-label::-webkit-scrollbar {
        display: none;
        width: 0;
        height: 0;
    }

    body.product-list-page.multi-purpose-camera-list-page .atf-page-heading.atf-align-left:not(:has(.banner-center-btn)):not(:has(.btn-banner-center)):not(:has(#buy_btn)) .atf-post-label > span,
    body.product-list-page.multi-purpose-camera-list-page .atf-page-heading.atf-align-left:not(:has(.banner-center-btn)):not(:has(.btn-banner-center)):not(:has(#buy_btn)) .atf-post-label > span a {
        flex: 0 0 auto;
        font-size: 14px;
        line-height: 22px;
        white-space: nowrap;
    }

    body.product-list-page.multi-purpose-camera-list-page .atf-page-heading.atf-align-left:not(:has(.banner-center-btn)):not(:has(.btn-banner-center)):not(:has(#buy_btn)) .atf-post-label > span:not(:last-child)::after {
        margin-right: 8px;
        margin-left: 8px;
    }

    /* Listing routes with the legacy details shell need the same compact entry rhythm. */
    body.product-list-page .atf_portfolio__details-area.atf-section-padding {
        padding-top: 24px !important;
        padding-bottom: 32px !important;
    }
}
@media (max-width: 767px) {
    body.product-list-page .atf-portfolio-area .portfolio-filter {
        gap: 8px;
    }

    body.product-list-page .filter-button-container .portfolio-filter button,
    body.product-list-page .filter-button-container .portfolio-filter button:first-child,
    body.product-list-page .filter-button-container .portfolio-filter button:last-child {
        padding-inline: 14px;
    }

    body.product-list-page .atf-portfolio-grid > .grid-item {
        margin-bottom: 16px !important;
    }
}

/* Compact two-column product cards for standard-width phones. */
@media (min-width: 390px) and (max-width: 767px) {
    body.product-list-page .atf-portfolio-grid,
    body.product-list-page #header_type > .row {
        --bs-gutter-x: 12px;
        align-items: stretch;
    }

    body.product-list-page .grid-item {
        flex: 0 0 50% !important;
        width: 50% !important;
        max-width: 50% !important;
    }

    body.product-list-page .grid-item > .atf-single-team.atf-product-card {
        height: 100%;
    }

    body.product-list-page .atf-single-team.atf-product-card > .atf-team-pic,
    body.product-list-page .atf-single-team.atf-product-card.v2-card > .atf-team-pic {
        height: clamp(150px, 42vw, 180px);
        margin: 6px;
        margin-bottom: 4px;
    }

    body.product-list-page .atf-single-team.atf-product-card .atf-team-prof,
    body.product-list-page .atf-single-team.atf-product-card.v2-card .atf-team-prof {
        padding: 0 10px 12px;
    }

    body.product-list-page .product-card-content {
        flex-grow: 1;
    }

    body.product-list-page h4.atf-team-title,
    body.product-list-page .atf-single-team.atf-product-card.v2-card h4.atf-team-title {
        height: auto;
        min-height: 0;
        margin-top: 10px;
        margin-bottom: 8px;
        font-size: 15px;
        line-height: 1.35;
    }

    body.product-list-page h4.atf-team-title a,
    body.product-list-page .atf-single-team.atf-product-card.v2-card h4.atf-team-title a {
        display: block;
        overflow: visible;
        -webkit-line-clamp: unset;
    }

    body.product-list-page .atf-product-features {
        display: flex;
        flex-wrap: wrap;
        align-content: flex-start;
        gap: 6px;
        min-height: 0;
        margin-top: 0;
        margin-bottom: 0;
    }

    body.product-list-page .feature-tag,
    body.product-list-page .atf-single-team.atf-product-card.v2-card .feature-tag {
        max-width: 100%;
        padding: 3px 6px;
        font-size: 11px;
        line-height: 1.3;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    body.product-list-page .atf-product-actions,
    body.product-list-page .atf-single-team.atf-product-card.v2-card .atf-product-actions {
        gap: 8px;
        margin-top: auto;
        padding-top: 12px;
    }

    body.product-list-page .atf-product-actions .atf-themes-btn,
    body.product-list-page .atf-product-actions .atf-themes-btn.d-block,
    body.product-list-page .atf-single-team.atf-product-card.v2-card .atf-themes-btn {
        min-height: 44px;
        height: auto;
        padding: 8px;
        font-size: clamp(12px, 3.1vw, 13px);
        line-height: 1.2;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    body.product-list-page .atf-product-badge,
    body.product-list-page .atf-single-team.atf-product-card.v2-card .atf-product-badge {
        top: 8px;
        right: 8px;
        max-width: calc(100% - 16px);
        padding: 4px 8px;
        font-size: 10px;
        line-height: 1.25;
        text-align: center;
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

/* Related product cards share the compact listing-card behavior on phones. */
@media (max-width: 767px) {
    body.product-detail-v2 #header_type .product-mobile-carousel-shell {
        width: 100%;
        margin-right: 0;
        margin-left: 0;
    }

    body.product-detail-v2 #header_type > .row,
    body.product-detail-v2 #header_type .atf-portfolio-grid,
    body.product-detail-v2 #header_type .product-mobile-carousel-track {
        --bs-gutter-x: 12px;
        display: flex;
        flex-wrap: wrap !important;
        align-items: stretch;
        gap: 16px 12px;
        width: 100%;
        margin: 0;
        padding: 0;
        overflow: visible;
        scroll-snap-type: none;
    }

    body.product-detail-v2 #header_type .product-mobile-carousel-controls {
        display: none;
    }

    body.product-detail-v2 #header_type .grid-item {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        display: flex !important;
        flex: 0 0 100% !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin-bottom: 0 !important;
        transform: none !important;
        scroll-snap-align: none;
    }

    body.product-detail-v2 #header_type .grid-item > .atf-single-team.atf-product-card {
        display: flex;
        flex-direction: column;
        width: 100%;
        height: 100%;
        min-height: 0;
    }

    body.product-detail-v2 #header_type .atf-single-team.atf-product-card > .atf-team-pic,
    body.product-detail-v2 #header_type .atf-single-team.atf-product-card.v2-card > .atf-team-pic {
        height: clamp(260px, 72vw, 320px);
        min-height: 0;
        overflow: hidden;
    }

    body.product-detail-v2 #header_type .atf-team-pic picture {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        margin: 0;
        transform: none;
        transform-origin: center;
    }

    body.product-detail-v2 #header_type .atf-team-pic > img,
    body.product-detail-v2 #header_type .atf-team-pic picture img {
        width: auto;
        max-width: 100%;
        height: auto;
        max-height: 100%;
        margin: 0;
        object-fit: contain;
    }

    body.product-detail-v2 #header_type .atf-product-card:hover > .atf-team-pic picture {
        transform: none;
    }

    body.product-detail-v2 #header_type .atf-team-prof,
    body.product-detail-v2 #header_type .product-card-content {
        display: flex;
        flex: 1 1 auto;
        flex-direction: column;
        min-width: 0;
        min-height: 0;
    }

    body.product-detail-v2 #header_type h4.atf-team-title {
        height: auto;
        min-height: 0;
        margin-top: 12px;
        margin-bottom: 10px;
        overflow-wrap: anywhere;
    }

    body.product-detail-v2 #header_type h4.atf-team-title a {
        display: block;
        overflow: visible;
        -webkit-line-clamp: unset;
    }

    body.product-detail-v2 #header_type .atf-product-features {
        display: flex;
        flex-wrap: wrap;
        align-content: flex-start;
        gap: 6px;
        min-height: 0;
    }

    body.product-detail-v2 #header_type .feature-tag {
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    body.product-detail-v2 #header_type .atf-product-actions {
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 8px;
        min-height: 0;
        margin-top: auto;
        padding-top: 12px;
    }

    body.product-detail-v2 #header_type .atf-product-actions .atf-themes-btn,
    body.product-detail-v2 #header_type .atf-product-actions .atf-themes-btn.d-block {
        flex: 0 0 auto;
        width: 100%;
        min-width: 0;
        min-height: 44px;
        height: auto;
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

@media (min-width: 390px) and (max-width: 767px) {
    body.product-detail-v2 #header_type .grid-item {
        flex-basis: calc((100% - 12px) / 2) !important;
        width: calc((100% - 12px) / 2) !important;
        max-width: calc((100% - 12px) / 2) !important;
    }

    body.product-detail-v2 #header_type .atf-single-team.atf-product-card > .atf-team-pic,
    body.product-detail-v2 #header_type .atf-single-team.atf-product-card.v2-card > .atf-team-pic {
        height: clamp(150px, 42vw, 180px);
        margin: 6px 6px 4px;
    }

    body.product-detail-v2 #header_type .atf-team-prof {
        padding: 0 10px 12px;
    }

    body.product-detail-v2 #header_type h4.atf-team-title {
        margin-top: 10px;
        margin-bottom: 8px;
        font-size: 15px;
        line-height: 1.35;
    }

    body.product-detail-v2 #header_type .feature-tag {
        padding: 3px 6px;
        font-size: 11px;
        line-height: 1.3;
    }

    body.product-detail-v2 #header_type .atf-product-actions .atf-themes-btn,
    body.product-detail-v2 #header_type .atf-product-actions .atf-themes-btn.d-block {
        padding: 8px;
        font-size: clamp(12px, 3.1vw, 13px);
        line-height: 1.2;
    }

    body.product-detail-v2 #header_type .atf-product-badge {
        top: 8px;
        right: 8px;
        max-width: calc(100% - 16px);
        padding: 4px 8px;
        font-size: 10px;
        line-height: 1.25;
        text-align: center;
        white-space: normal;
        overflow-wrap: anywhere;
    }
}
