/* ===========================================
   pages/catalog/mega_hub_hero.css
   目录页：三栏 Hero
   桌面：左介绍 · 中大图 · 右缩略；中栏略宽，不是 1:1:1
   三列比卡网左右探出（--catalog-hero-outset），不贴视口
   Nav / 卡网仍走 --catalog-well-max（category.css，约 80rem）
   窄屏方案 B（<64em）：刊头左齐；h1+口号 → 轮播 → 其余介绍。
     为什么：居中只适合 1–2 行海报；段落+列表居中难扫、挡图。
     Pad 与手机同一结构（两栏从 ≥64em 才开始），正文约 40em 避免 iPad 一行过长。
     桌面左栏仍滚动，不截断。
     文档：Nadulite Mega Hero改版.md §六 / §10.4 · 网站设计.md 16.397 · 16.419
     中栏主图 Ken Burns：.heroKenBurns（stories_hero_ken_burns.css）；右栏缩略不加

   挂图命名（与 pack_catalog_gallery_scene 一致，禁止旧 Stem）：
     库 stem：catalog/gallery/{folder}/{semantic}-hero-{nn}
     盘文件：{stem}-desktop|tablet|mobile.{webp|jpg|png}
     断点：≥64em 中栏 desktop · 48–64em 轮播 tablet · <48em 轮播 mobile
     文档：Nadulite Mega Hero改版.md §十二
=========================================== */

/* ① Hero：外层色带全宽；三列比卡网更宽，左右探出，不贴视口 */
.mega-hub-hero {
    width: 100%;
    margin: 0;
    padding: 0.875rem 0;
    background: #f3f4f6;
    color: var(--color-text, #1a2f34);
    box-sizing: border-box;
}

.mega-hub-hero__inner {
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.5fr) minmax(0, 0.75fr);
    grid-template-areas: "intro stage scenes";
    gap: 0.5rem;
    align-items: stretch;
    width: 100%;
    max-width: min(
        calc(var(--catalog-well-max, 80rem) + 2 * var(--catalog-hero-outset, 7.5rem)),
        calc(100% - 2 * var(--catalog-hero-edge, 1.25rem))
    );
    margin-inline: auto;
    padding-inline: 0;
    /* 下限，不是死高度；行高再取中栏/右栏，左栏文案不计入 */
    min-height: min(46vh, 31.25rem);
    box-sizing: border-box;
}

.catalog-page--three-col-hero > .lp-main,
.page-mega-index .lp-main.lp-main--full,
.page-catalog-product-list .lp-main.lp-main--full {
    margin-top: 0;
}

.mega-hub-hero-intro {
    grid-area: intro;
    display: flex;
    flex-direction: column;
    justify-content: center;
    justify-content: safe center;
    min-width: 0;
    min-height: 0;
    padding: clamp(1.5rem, 3.2vw, 3rem) clamp(1.25rem, 2.4vw, 2.5rem);
    background: var(--color-bg-alt, #e4ecec);
    border-radius: 0.25rem;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(32, 80, 88, 0.35) transparent;
}

.mega-hub-hero-intro__mast,
.mega-hub-hero-intro__story {
    min-width: 0;
}

.mega-hub-hero-intro__body {
    min-width: 0;
}

/* 桌面三栏：左栏不参与 auto 行的 max-content，否则 intro_html 会把整块 Hero 撑高。
   行高 = max(min(46vh, 31.25rem), 中栏舞台 min-height, 右栏缩略网格)。
   height:0 + min-height:100% 让介绍跟行高走，超出栏内滚动（§10.4）。 */
@media (min-width: 64em) {
    .mega-hub-hero-intro {
        height: 0;
        min-height: 100%;
        align-self: stretch;
    }
}

.mega-hub-hero-intro::-webkit-scrollbar {
    width: 0.375rem;
}

.mega-hub-hero-intro::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(32, 80, 88, 0.35);
}

.mega-hub-hero-intro__title {
    margin: 0 0 0.75rem;
    font-family: var(--font-sans, inherit);
    font-size: clamp(1.55rem, 2.4vw, 2.15rem);
    font-weight: 500;
    letter-spacing: -0.03em;
    line-height: 1.18;
    color: var(--color-primary, #1a2f34);
}

.mega-hub-hero-intro__summary {
    margin: 0;
    max-width: 22em;
    font-size: 0.92rem;
    line-height: 1.7;
    color: var(--color-text-muted, #5a6b6e);
}

.mega-hub-hero-intro__rich {
    max-width: 22em;
    font-size: 0.92rem;
    line-height: 1.7;
    color: var(--color-text-muted, #5a6b6e);
}

.mega-hub-hero-intro__rich p {
    margin: 0 0 0.75rem;
}

.mega-hub-hero-intro__rich p:last-child {
    margin-bottom: 0;
}

.mega-hub-hero-intro__rich p > em:only-child,
.mega-hub-hero-intro__rich p > i:only-child {
    display: block;
    font-style: italic;
    font-size: 0.88em;
    letter-spacing: 0.02em;
    color: var(--color-primary, #1a2f34);
}

.mega-hub-hero-intro__rich ul,
.mega-hub-hero-intro__rich ol {
    /* 强缩进 = 整块列表相对段落内移（margin），点和字一起走。
       padding 只给标记槽（约 1.25em）。outside + 过大 padding 会把点钉在左边、
       文字推到右边，点字间距被撑开——16.399 的 2rem+0.75rem 就是这个坑。 */
    margin: 0 0 0.85rem;
    margin-inline-start: 1.25rem;
    padding-inline-start: 1.25em;
    list-style-position: outside;
}

.mega-hub-hero-intro__rich li {
    margin: 0.35em 0;
    padding-inline-start: 0;
}

.mega-hub-hero-stage {
    grid-area: stage;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* 中栏容器只裁切；图画在 .heroKenBurns__el 上，transform 才不放大格子 */
.mega-hub-hero-stage__media {
    position: relative;
    flex: 1 1 auto;
    width: 100%;
    min-height: min(46vh, 31.25rem);
    overflow: hidden;
    border-radius: 0.25rem;
    box-shadow: none;
    background-color: var(--color-bg-alt, #e4ecec);
}

.mega-hub-hero-stage__media .heroKenBurns__el {
    background-color: inherit;
    background-image: var(--mega-hub-hero-stage-mobile);
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}

@media (min-width: 48em) {
    .mega-hub-hero-stage__media .heroKenBurns__el {
        background-image: var(--mega-hub-hero-stage-tablet);
    }
}

@media (min-width: 64em) {
    .mega-hub-hero-stage__media .heroKenBurns__el {
        background-image: var(--mega-hub-hero-stage-desktop);
    }
}

.mega-hub-hero-carousel {
    display: none;
}

.mega-hub-hero-scenes {
    grid-area: scenes;
    min-width: 0;
    min-height: 0;
    display: flex;
    align-items: flex-start;
    padding: 0.25rem;
    background: var(--color-bg, #f4f7f7);
    border-radius: 0.25rem;
}

.mega-hub-hero-scenes__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: auto;
    gap: 0.25rem;
    align-content: start;
    width: 100%;
    min-height: 0;
}

.mega-hub-hero-scenes__thumb {
    position: relative;
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 5 / 4;
    padding: 0;
    border: 0.125rem solid transparent;
    border-radius: 0.125rem;
    background: var(--color-bg-alt, #e4ecec);
    cursor: pointer;
    overflow: hidden;
}

.mega-hub-hero-scenes__thumb img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.mega-hub-hero-scenes__thumb.is-active {
    border-color: var(--color-accent, #205058);
}

.mega-hub-hero-scenes__thumb:hover {
    border-color: var(--color-accent-light, #b8a898);
}

.mega-hub-hero-scenes__thumb.is-active:hover {
    border-color: var(--color-accent, #205058);
}

.mega-hub-hero-scenes__thumb:focus-visible {
    outline: 0.125rem solid var(--color-accent, #205058);
    outline-offset: 0.125rem;
}

/* 窄屏方案 B（<64em）：刊头左齐；h1+口号 → 轮播 → 其余介绍。
   为什么不用居中：居中只适合 1–2 行海报；段落+列表居中难扫、挡图。
   Pad 与手机同一结构（两栏从 ≥64em 才开始）。
   三端图：≥64em 中栏 desktop；48–63.9em 轮播 tablet；<48em 轮播 mobile。 */
@media (max-width: 63.9375em) {
    .mega-hub-hero {
        padding: 0.75rem 0;
        background: #f3f4f6;
    }

    .mega-hub-hero__inner {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "mast"
            "stage"
            "story";
        gap: 0;
        min-height: 0;
        max-width: var(--catalog-well-max, 80rem);
        padding-inline: var(--catalog-well-pad, clamp(1rem, 2.2vw, 2rem));
    }

    .mega-hub-hero-intro {
        display: contents;
        height: auto;
        min-height: 0;
        padding: 0;
        background: transparent;
        overflow: visible;
    }

    .mega-hub-hero-intro__mast {
        grid-area: mast;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        text-align: start;
        max-width: 40em;
        padding: 0.5rem 0 1rem;
        background: transparent;
        overflow: visible;
    }

    .mega-hub-hero-intro__story {
        grid-area: story;
        display: block;
        text-align: start;
        max-width: 40em;
        padding: 1.25rem 0 0.25rem;
        background: transparent;
        overflow: visible;
    }

    .mega-hub-hero-intro__title {
        margin-bottom: 0.5rem;
    }

    .mega-hub-hero-intro__summary,
    .mega-hub-hero-intro__rich {
        max-width: 40em;
        text-align: start;
    }

    .mega-hub-hero-intro__rich ul,
    .mega-hub-hero-intro__rich ol {
        text-align: start;
    }

    .mega-hub-hero-scenes {
        display: none;
    }

    .mega-hub-hero-stage__media {
        display: none;
        min-height: 0;
    }

    .mega-hub-hero-carousel {
        display: block;
        position: relative;
        width: 100%;
        min-width: 0;
        padding: 0;
    }

    .mega-hub-hero-carousel__track {
        display: flex;
        gap: 0;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-snap-stop: always;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 0;
        box-sizing: border-box;
    }

    .mega-hub-hero-carousel__track::-webkit-scrollbar {
        display: none;
    }

    .mega-hub-hero-carousel__slide {
        flex: 0 0 100%;
        width: 100%;
        scroll-snap-align: start;
        opacity: 1;
        transform: none;
        overflow: hidden;
        border-radius: 0;
        background: var(--color-bg-alt, #e4ecec);
    }

    .mega-hub-hero-carousel__slide img {
        display: block;
        width: 100%;
        aspect-ratio: 4 / 3;
        height: auto;
        object-fit: cover;
        object-position: center 28%;
    }

    /* 只让当前张推拉；未激活的 slide 停在 scale(1)，省 GPU */
    .mega-hub-hero-carousel__slide:not(.is-active) img {
        animation: none;
        transform: none;
    }

    .mega-hub-hero-carousel__slide picture {
        display: block;
        width: 100%;
    }

    .mega-hub-hero-carousel__bars {
        display: flex;
        justify-content: stretch;
        align-items: center;
        flex-wrap: nowrap;
        gap: 0.25rem;
        width: 100%;
        margin: 0.75rem 0 0;
        padding: 0;
        box-sizing: border-box;
    }

    .mega-hub-hero-carousel__bar {
        position: relative;
        flex: 1 1 0;
        width: auto;
        min-width: 0;
        height: 1.75rem;
        padding: 0;
        border: none;
        background: transparent;
        cursor: pointer;
        appearance: none;
        -webkit-appearance: none;
    }

    .mega-hub-hero-carousel__bar::after {
        content: '';
        position: absolute;
        left: 0;
        right: 0;
        top: 50%;
        width: auto;
        height: 0.125rem;
        border-radius: 999px;
        background: rgba(26, 47, 52, 0.18);
        transform: translateY(-50%);
        transform-origin: center center;
        transition: background 0.28s ease, height 0.28s ease;
    }

    .mega-hub-hero-carousel__bar.is-active::after {
        height: 0.1875rem;
        background: var(--color-accent, #205058);
        animation: megaHubHeroBarBreath 2.2s ease-in-out infinite;
    }

    .mega-hub-hero-carousel__bar:focus-visible {
        outline: 0.125rem solid var(--color-accent, #205058);
        outline-offset: 0.125rem;
    }

    .mega-hub-hero-carousel__status {
        position: absolute;
        width: 0.0625rem;
        height: 0.0625rem;
        padding: 0;
        margin: -0.0625rem;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mega-hub-hero-carousel__slide {
        transition: none;
    }

    .mega-hub-hero-carousel__track {
        scroll-behavior: auto;
    }

    .mega-hub-hero-carousel__bar.is-active::after {
        animation: none;
    }
}

@keyframes megaHubHeroBarBreath {
    0%,
    100% {
        opacity: 0.45;
    }
    50% {
        opacity: 1;
    }
}
