/* One recording per chapter; the interface stays the visual focus. */
.product-chapter {
    --chapter-accent: 63, 171, 223;
    --video-ratio: 1.75;
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-height: 100svh;
    padding: 76px 3vw 34px;
    display: grid;
    place-items: center;
    background: #0c1724;
    scroll-margin-top: 0;
}
.chapter-1, .chapter-2 { --video-ratio: 1.538; }
.chapter-2, .chapter-5 { --chapter-accent: 57, 154, 192; background: #102333; }
.chapter-3, .chapter-6 { --chapter-accent: 80, 145, 223; background: #0b192d; }
.chapter-4, .chapter-7 { --chapter-accent: 83, 182, 202; background: #10212b; }
.product-chapter::before {
    content: "";
    position: absolute;
    inset: -15%;
    z-index: -2;
    pointer-events: none;
    background: radial-gradient(ellipse at 18% 25%, rgba(var(--chapter-accent), .2), transparent 48%), radial-gradient(ellipse at 86% 80%, rgba(var(--chapter-accent), .12), transparent 45%);
    animation: chapter-light 16s ease-in-out infinite alternate;
    animation-play-state: paused;
}
.product-chapter.is-active::before { animation-play-state: running; }
.chapter-decoration {
    position: absolute;
    z-index: -1;
    inset: 0;
    pointer-events: none;
    opacity: .6;
    background-image: linear-gradient(rgba(var(--chapter-accent), .055) 1px, transparent 1px), linear-gradient(90deg, rgba(var(--chapter-accent), .055) 1px, transparent 1px);
    background-size: 88px 88px;
    mask-image: linear-gradient(90deg, #000, transparent 25%, transparent 75%, #000);
}
.chapter-decoration::before, .chapter-decoration::after {
    content: "";
    position: absolute;
    width: min(66vw, 900px);
    aspect-ratio: 1;
    border: 1px solid rgba(var(--chapter-accent), .24);
    border-radius: 50%;
    left: -40%;
    top: 15%;
}
.chapter-decoration::after { left: auto; right: -35%; top: -40%; }
.chapter-content { width: 100%; max-width: 1600px; margin: auto; }
.chapter-heading { margin: 0 auto 22px; text-align: center; }
body.landing .chapter-heading h2 {
    font-size: clamp(1.45rem, 2.7vw, 2.65rem);
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: .025em;
    margin: 0 0 10px;
    color: #f0f7ff;
}
.chapter-heading p { font-size: clamp(.88rem, 1.15vw, 1.05rem); line-height: 1.6; color: #b5cadb; margin: 0; }
.chapter-player {
    width: min(100%, calc((100svh - 230px) * var(--video-ratio)));
    min-width: min(100%, 760px);
    margin: 0 auto;
    border: 1px solid rgba(var(--chapter-accent), .36);
    border-radius: 12px;
    background: #09121d;
    box-shadow: 0 24px 80px #0005, 0 0 55px rgba(var(--chapter-accent), .09);
    overflow: hidden;
}
.product-video { width: 100%; aspect-ratio: var(--video-ratio); height: auto; display: block; object-fit: contain; background: #101010; }
.product-video:fullscreen { width: 100%; height: 100%; object-fit: contain; }
.chapter-player figcaption { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 18px; color: #d4e6f1; font-size: .82rem; line-height: 1.4; }
.chapter-label, .chapter-tools { display: flex; align-items: center; gap: 20px; }
.chapter-count { color: #7fabc4; font-variant-numeric: tabular-nums; font-size: .72rem; letter-spacing: .06em; }
body.landing .chapter-tools button { appearance: none; border: 0; box-shadow: none; background: transparent; color: #c6eaff; font-size: .8rem; font-weight: 500; line-height: 1.4; height: auto; padding: 8px 4px; letter-spacing: .025em; text-transform: none; border-radius: 3px; }
body.landing .chapter-tools button:hover { color: #fff; background: #ffffff0a; }
.chapter-error { margin: 0; padding: 12px 18px; color: #d4e6f1; font-size: .9rem; }
.showcase-motion .chapter-heading, .showcase-motion .chapter-player { opacity: 0; transform: translateY(28px); transition: opacity .8s ease, transform .8s cubic-bezier(.2,.7,.2,1); }
.showcase-motion .chapter-player { transition-delay: .12s; }
.showcase-motion .is-revealed .chapter-heading, .showcase-motion .is-revealed .chapter-player { opacity: 1; transform: none; }
@keyframes chapter-light { from { transform: translate3d(-3%, -2%, 0); } to { transform: translate3d(5%, 4%, 0); } }
@media (max-width: 736px) {
    .product-chapter { padding: 80px 14px 36px; }
    .chapter-heading { margin-bottom: 24px; }
    .chapter-heading p { max-width: 30em; margin: auto; }
    .chapter-player { width: 100%; min-width: 0; border-radius: 8px; }
    .chapter-player figcaption { padding: 8px 10px; gap: 8px; }
    .chapter-label, .chapter-tools { gap: 10px; }
    .chapter-count { font-size: .65rem; }
    .chapter-label { font-size: .75rem; }
}
@media (prefers-reduced-motion: reduce) {
    .product-chapter::before { animation: none; }
    .showcase-motion .chapter-heading, .showcase-motion .chapter-player { opacity: 1; transform: none; transition: none; }
}

/* The next chapter becomes available after the first complete viewing. */
.chapter-next[hidden] { display: none !important; }
.chapter-next { display: inline-flex; align-items: center; gap: 8px; color: #8fddff; border-bottom: 0; font-size: .82rem; white-space: nowrap; animation: chapter-next-in .45s ease both; }
.chapter-next:hover { color: #fff; }
.chapter-next span { font-size: 1.2em; }
.chapter-tools { flex-wrap: wrap; justify-content: flex-end; }
@keyframes chapter-next-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 736px) {
    .chapter-player figcaption { flex-wrap: wrap; }
    .chapter-next { font-size: .78rem; }
}
@media (prefers-reduced-motion: reduce) { .chapter-next { animation: none; } }

/* Mobile adaptations are isolated from the desktop presentation. */
.fullscreen-mobile, .chapter-mobile-hint { display: none; }
@media (max-width: 736px), (max-width: 1024px) and (pointer: coarse) {
    body.landing #banner { min-height: 100svh; min-height: 100dvh; padding-top: calc(72px + env(safe-area-inset-top)) !important; padding-bottom: calc(48px + env(safe-area-inset-bottom)) !important; }
    .product-chapter { min-height: 100svh; min-height: 100dvh; padding: calc(64px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
    .chapter-player { width: 100%; min-width: 0; }
    .chapter-heading { padding: 0 8px; }
    .chapter-player figcaption { display: grid; grid-template-columns: 1fr; gap: 4px; padding: 8px 12px; }
    .chapter-label { justify-content: space-between; font-size: .8rem; }
    .chapter-tools { display: flex; justify-content: flex-end; gap: 8px; }
    body.landing .chapter-tools button, .chapter-next { min-height: 44px; min-width: 44px; padding: 10px 12px; display: inline-flex; align-items: center; justify-content: center; touch-action: manipulation; font-size: .82rem; }
    body.landing .chapter-tools .chapter-fullscreen { background: #17445e; border-radius: 6px; color: #e8f8ff; }
    .fullscreen-desktop { display: none; }
    .fullscreen-mobile { display: inline; }
    .chapter-mobile-hint { display: block; margin: 12px 0 0; text-align: center; color: #a4bfd0; font-size: .75rem; line-height: 1.5; }
    #footer { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
    #footer .icons a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; }
    .hostudy-modal__dialog { max-width: calc(100vw - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; }
    #wechat-modal img { max-width: 100%; height: auto; }
}
@media (max-width: 1024px) and (orientation: landscape) and (pointer: coarse) {
    .product-chapter { padding-top: calc(52px + env(safe-area-inset-top)); padding-bottom: max(8px, env(safe-area-inset-bottom)); }
    .chapter-heading { margin-bottom: 8px; }
    body.landing .chapter-heading h2 { font-size: 1.15rem; margin-bottom: 4px; }
    .chapter-heading p, .chapter-mobile-hint { display: none; }
    .chapter-player { width: min(100%, calc((100dvh - 144px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * var(--video-ratio))); min-width: 0; }
    .chapter-player figcaption { display: flex; padding: 2px 8px; gap: 8px; }
    .chapter-label { gap: 10px; }
    .chapter-count { display: none; }
    .chapter-tools { gap: 2px; }
    body.landing .chapter-tools button, .chapter-next { padding: 8px; }
}

/* Keep the complete wordmark and exploration link inside the mobile hero. */
@media (max-width: 736px), (max-width: 1024px) and (pointer: coarse) {
    body.landing #banner {
        height: auto;
        min-height: 100svh;
        min-height: 100dvh;
        padding-bottom: calc(24px + env(safe-area-inset-bottom)) !important;
        gap: 24px;
    }
    #banner .inner { width: 100%; max-width: 100%; min-width: 0; }
    #banner .hostudy-wordmark { width: 100%; max-width: min(560px, 100%); min-width: 0; height: auto; }
    body.landing #banner .more {
        display: block;
        position: relative;
        flex: 0 0 auto;
        left: auto;
        bottom: auto;
        width: auto;
        min-width: 120px;
        height: auto;
        min-height: 4.25em;
        margin: 1.35rem auto 0;
        padding: 0 8px 2.1em;
        line-height: 24px;
        opacity: 1;
        transform: none;
        transition-delay: 0s;
    }
    body.landing #banner .more::after { bottom: 0.35em; }
}
