Files
openmotion/studio/src/motion/Magi2LaunchModal.module.css
hazel-ye 595979d24e feat(studio): add Black Friday MAGI-2 launch video modal across all locales (#1169)
* feat(studio): add Black Friday MAGI-2 launch video modal across all locales

* fix(studio): settle Explore Black Friday hero and pause 3D motion while MAGI-2 modal is active

* feat(explore): update MAGI-2 modal copy for all annual plans, arrow CTA, and zero-drift countdown

* fix(studio): reuse MAGI2_MODAL_SEEN_COOKIE for dismissed storage key to avoid gitleaks false positive

* fix(studio): harden MAGI-2 modal audience check, perf, focus, and Hero coordination

Address PR #1169 review findings while preserving all eae60e05c copy, arrow CTA, and zero-drift countdown improvements:
- Rename MAGI2_MODAL_DISMISSED_KEY to MAGI2_MODAL_DISMISSED_STORAGE_NAME (aliasing MAGI2_MODAL_SEEN_COOKIE) to avoid gitleaks generic-api-key false positives
- Fail closed in classifyMagi2Audience via explicit 'free' allowlist and mediaEntitlement === 'included' check
- Remove bundled magi2-planet-6s.mp4 and load remotely from https://open-design.ai/black-friday-modal/magi2-planet-6s.mp4 while keeping the local WebP poster fallback
- Migrate 11-locale MAGI-2 modal copy into lazy-loaded studio/src/i18n/campaign-ui.json chunks
- Move CTA breathing/halo animations onto GPU compositor-only pseudo-elements (opacity/transform) and dirty-check countdown DOM writes
- Split user dismissal (280ms exit animation) from external suppression (immediate unmount), wire focus management with useDialogBehavior, reuse countdown/entry-source helpers from campaignAttribution, and collapse ExploreBlackFridayHero only when the modal actually opens

* test(studio): stub window.requestAnimationFrame under fake timers in Magi2LaunchModal test

* feat(studio): show MAGI-2 launch modal to all users regardless of plan tier
2026-11-27 19:32:18 +08:00

502 lines
9.8 KiB
CSS

.backdrop {
--om-m2-bg: var(--motion-neutral-n11);
--om-m2-ink: var(--motion-neutral-n2);
--om-m2-secondary: var(--motion-neutral-n6);
--om-m2-accent: color-mix(in srgb, var(--motion-black-friday-flame) 66%, var(--motion-black-friday-vermilion));
--om-m2-countdown: color-mix(in srgb, var(--motion-black-friday-flame) 76%, var(--motion-black-friday-vermilion));
--om-m2-countdown-colon: color-mix(in srgb, var(--om-m2-countdown) 72%, transparent);
--om-m2-cta-shadow-rest: color-mix(in srgb, var(--motion-black-friday-ink-light) 12%, transparent);
--om-m2-cta-shadow-peak: color-mix(in srgb, var(--motion-black-friday-ink-light) 22%, transparent);
--om-m2-cta-glow: color-mix(in srgb, var(--om-m2-accent) 22%, transparent);
--om-m2-cta-ring: color-mix(in srgb, var(--motion-black-friday-ink-light) 34%, transparent);
position: fixed;
inset: 0;
z-index: 1200;
display: grid;
place-items: center;
padding: 20px 16px;
background: color-mix(in srgb, var(--motion-black-friday-stage-black) 72%, transparent);
opacity: 0;
pointer-events: none;
transition: opacity 260ms cubic-bezier(0.22, 1, 0.36, 1);
font-family: var(--motion-font-sans);
-webkit-font-smoothing: antialiased;
}
.backdrop[data-open='true'] {
opacity: 1;
pointer-events: auto;
}
.modal {
position: relative;
isolation: isolate;
contain: layout style paint;
width: min(960px, calc(100vw - 36px));
min-height: min(448px, calc(100dvh - 48px));
max-height: calc(100dvh - 32px);
background: var(--om-m2-bg);
color: var(--om-m2-ink);
border: none;
border-radius: 24px;
box-shadow: 0 36px 100px color-mix(in srgb, var(--motion-black-friday-stage-black) 82%, transparent);
display: grid;
grid-template-columns: 1.35fr 1fr;
overflow: hidden;
transform: translateY(14px) scale(0.965);
opacity: 0;
transition:
transform 380ms cubic-bezier(0.16, 1, 0.3, 1),
opacity 280ms cubic-bezier(0.16, 1, 0.3, 1);
box-sizing: border-box;
}
.backdrop[data-open='true'] .modal {
transform: translateY(0) scale(1);
opacity: 1;
}
.mediaPane {
padding: 12px 0 12px 12px;
display: flex;
min-width: 0;
}
.videoStage {
position: relative;
width: 100%;
height: 100%;
min-height: 424px;
border-radius: 16px;
overflow: hidden;
background: var(--motion-black-friday-stage-black);
border: none;
}
.video {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
object-fit: cover;
display: block;
background: var(--motion-black-friday-stage-black);
}
.videoScrim {
position: absolute;
inset: auto 0 0 0;
height: 112px;
background: linear-gradient(
0deg,
color-mix(in srgb, var(--motion-black-friday-stage-black) 62%, transparent) 0%,
color-mix(in srgb, var(--motion-black-friday-stage-black) 18%, transparent) 55%,
transparent 100%
);
pointer-events: none;
}
.contentPane {
position: relative;
padding: 48px 40px 42px;
display: flex;
flex-direction: column;
justify-content: center;
gap: 34px;
min-width: 0;
box-sizing: border-box;
}
.close {
position: absolute;
top: 16px;
right: 16px;
z-index: 4;
width: 30px;
height: 30px;
min-width: 30px;
min-height: 30px;
border-radius: 50%;
border: none;
background: transparent;
color: color-mix(in srgb, var(--motion-black-friday-ink-light) 56%, transparent);
display: grid;
place-items: center;
padding: 0;
cursor: pointer;
transition: background 150ms ease, color 150ms ease;
}
.close:hover {
background: color-mix(in srgb, var(--motion-black-friday-ink-light) 8%, transparent);
color: var(--motion-black-friday-ink-light);
}
.close:focus-visible {
outline: 1.5px solid color-mix(in srgb, var(--motion-black-friday-ink-light) 72%, transparent);
outline-offset: 2px;
}
.close svg {
width: 14px;
height: 14px;
display: block;
}
.heroCopy {
min-width: 0;
}
.eyebrow {
font-size: clamp(24px, 2.5vw, 28px);
font-weight: 700;
line-height: 1.24;
letter-spacing: -0.025em;
color: var(--om-m2-accent);
overflow-wrap: break-word;
}
.headline {
margin: 6px 0 0;
font-size: clamp(24px, 2.5vw, 28px);
font-weight: 700;
line-height: 1.24;
letter-spacing: -0.025em;
color: var(--motion-black-friday-ink-light);
overflow-wrap: break-word;
}
.modal[data-script='latin'] .eyebrow,
.modal[data-script='latin'] .headline {
font-size: clamp(22px, 2.3vw, 26px);
line-height: 1.2;
}
.desc {
margin: 16px 0 0;
font-size: 13.5px;
line-height: 1.72;
color: var(--om-m2-secondary);
overflow-wrap: break-word;
}
.desc strong {
color: var(--motion-neutral-n2);
font-weight: 600;
}
.actionGroup {
display: flex;
flex-direction: column;
gap: 16px;
}
.ctaStack {
display: flex;
flex-direction: column;
align-items: stretch;
width: 100%;
}
.cta {
position: relative;
height: 46px;
padding: 0 22px;
border-radius: 12px;
border: none;
background: var(--motion-black-friday-ink-light);
color: var(--motion-neutral-n11);
font-size: 15.5px;
font-weight: 700;
letter-spacing: -0.01em;
text-decoration: none;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
gap: 7px;
text-align: center;
box-sizing: border-box;
transition: background 180ms ease, transform 180ms ease;
box-shadow: 0 0 8px var(--om-m2-cta-shadow-rest);
}
.cta::before {
content: '';
position: absolute;
inset: 0;
border-radius: inherit;
pointer-events: none;
box-shadow:
0 0 16px var(--om-m2-cta-shadow-peak),
0 0 14px var(--om-m2-cta-glow);
opacity: 0;
transition: opacity 180ms ease;
}
.modal[data-playing='true'] .cta::before {
animation: omMagi2CtaBreathe 2.4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
will-change: opacity;
}
.cta::after {
content: '';
position: absolute;
inset: 0;
border-radius: inherit;
pointer-events: none;
box-shadow: 0 0 0 2px var(--om-m2-cta-ring);
opacity: 0;
transform: scale(1);
}
.modal[data-playing='true'] .cta::after {
animation: omMagi2CtaHalo 2.4s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
will-change: transform, opacity;
}
@keyframes omMagi2CtaBreathe {
0%,
100% {
opacity: 0;
}
50% {
opacity: 1;
}
}
@keyframes omMagi2CtaHalo {
0% {
transform: scale(1);
opacity: 0;
}
25% {
opacity: 0.52;
}
100% {
transform: scale(1.035, 1.18);
opacity: 0;
}
}
.cta:hover {
background: var(--motion-neutral-n2);
color: var(--motion-neutral-n11);
transform: translateY(-1px) scale(1.015);
}
.cta:hover::before {
animation: none;
opacity: 1;
}
.cta:hover::after {
animation: none;
opacity: 0;
}
.cta:active {
transform: translateY(0) scale(0.985);
}
.cta:active::before,
.cta:active::after {
animation: none;
}
.cta:focus-visible {
outline: 2px solid var(--om-m2-accent);
outline-offset: 2px;
}
.ctaText {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.ctaArrow {
width: 16px;
height: 16px;
flex-shrink: 0;
display: block;
transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}
.cta:hover .ctaArrow {
transform: translateX(3px);
}
.countdown {
display: flex;
align-items: baseline;
justify-content: center;
flex-wrap: wrap;
gap: 7px;
font-size: 13.5px;
line-height: 1.4;
font-variant-numeric: tabular-nums;
letter-spacing: 0.015em;
}
.countdownLabel {
font-size: 13px;
font-weight: 500;
color: color-mix(in srgb, var(--motion-black-friday-ink-light) 56%, transparent);
white-space: nowrap;
}
.countdownTime {
display: inline-flex;
align-items: baseline;
font-family: var(--motion-font-mono);
font-size: 13.5px;
font-weight: 600;
font-variant-numeric: tabular-nums;
font-feature-settings: 'tnum' 1;
letter-spacing: 0;
white-space: nowrap;
color: var(--om-m2-countdown);
}
.digitSeg {
display: inline-flex;
justify-content: center;
width: 2ch;
font-variant-numeric: tabular-nums;
font-feature-settings: 'tnum' 1;
}
.colon,
.dot {
display: inline-flex;
justify-content: center;
width: 0.72ch;
color: var(--om-m2-countdown-colon);
}
.dot {
color: var(--om-m2-countdown);
}
.msGroup {
display: inline-flex;
align-items: baseline;
color: var(--om-m2-countdown);
}
@media (prefers-reduced-motion: reduce) {
.backdrop,
.modal,
.cta,
.cta::before,
.cta::after,
.ctaArrow {
transition: none;
animation: none !important;
}
}
@media (max-width: 859px) {
.modal {
width: min(560px, calc(100vw - 32px));
min-height: 0;
max-height: calc(100dvh - 32px);
grid-template-columns: 1fr;
overflow-y: auto;
overscroll-behavior: contain;
}
.mediaPane {
padding: 10px 10px 0 10px;
}
.videoStage {
min-height: 0;
aspect-ratio: 16 / 9;
border-radius: 14px;
}
.contentPane {
position: static;
padding: 24px 28px 28px;
gap: 22px;
}
.close {
top: 18px;
right: 18px;
background: color-mix(in srgb, var(--motion-black-friday-stage-black) 56%, transparent);
color: color-mix(in srgb, var(--motion-black-friday-ink-light) 88%, transparent);
}
.close:hover {
background: color-mix(in srgb, var(--motion-black-friday-stage-black) 78%, transparent);
}
}
@media (max-width: 639px) {
.backdrop {
padding: 14px 12px;
}
.modal {
width: calc(100vw - 24px);
max-height: calc(100dvh - 28px);
border-radius: 20px;
}
.mediaPane {
padding: 8px 8px 0 8px;
}
.videoStage {
border-radius: 13px;
}
.contentPane {
padding: 20px 20px 22px;
gap: 18px;
}
.eyebrow,
.headline,
.modal[data-script='latin'] .eyebrow,
.modal[data-script='latin'] .headline {
font-size: 21px;
line-height: 1.24;
}
.headline {
margin-top: 4px;
}
.desc {
margin-top: 12px;
font-size: 13px;
line-height: 1.64;
}
.actionGroup {
gap: 14px;
}
.cta {
height: 46px;
font-size: 14.5px;
}
.countdown {
font-size: 12.5px;
}
.countdownLabel {
font-size: 12px;
}
.countdownTime {
font-size: 13px;
}
}