/* =========================================================
   CRM Syntax – motion & video layer
   Shared by index.html, salesforce-services.html,
   hubspot-services.html (add the same two tags to each page)
========================================================= */

/* ---------- Tones for the animated fallback behind every video ---------- */
[data-tone] { --t0: #032d60; --t1: rgba(1,118,211,.85); --t2: rgba(255,122,89,.45); }
[data-tone="salesforce"] { --t0: #032d60; --t1: #0176d3; --t2: #1b96ff; }
[data-tone="hubspot"]    { --t0: #1f2a44; --t1: #ff7a59; --t2: #ffb199; }

/* ---------- Media frame (video + fallback + shade) ---------- */
[data-video-frame] { position: relative; isolation: isolate; overflow: hidden; }

.media { position: absolute; inset: 0; z-index: 0; background: var(--t0); }

.media-fallback {
    position: absolute; inset: 0;
    background:
        radial-gradient(55% 75% at 18% 30%, var(--t1) 0, transparent 62%),
        radial-gradient(50% 70% at 82% 72%, var(--t2) 0, transparent 62%),
        var(--t0);
    background-size: 150% 150%;
    animation: drift 18s ease-in-out infinite alternate;
}

.media-video {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity .9s ease, transform .9s ease;
}
[data-video-frame].is-ready .media-video { opacity: 1; }

.media-shade { position: absolute; inset: 0; z-index: 1; pointer-events: none; }

/* ---------- Play / pause control ---------- */
.media-toggle {
    position: absolute; z-index: 4;
    width: 42px; height: 42px;
    display: grid; place-items: center;
    border: 1px solid rgba(255,255,255,.45);
    border-radius: 50%;
    background: rgba(3,20,45,.55);
    color: #fff;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease, background .2s ease;
    backdrop-filter: blur(6px);
}
.media-toggle:hover { background: rgba(3,20,45,.8); }
.media-toggle:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.media-toggle svg { width: 16px; height: 16px; fill: currentColor; }
.media-toggle .i-play { display: none; }
.is-paused > .media-toggle .i-play,
.is-paused .media-toggle .i-play { display: block; }
.is-paused > .media-toggle .i-pause,
.is-paused .media-toggle .i-pause { display: none; }
[data-video-frame].is-ready .media-toggle { opacity: 1; pointer-events: auto; }

/* ---------- Hero with background video ---------- */
.hero.has-video {
    position: relative;
    display: flex;
    align-items: center;
    min-height: min(88vh, 860px);
    padding: 130px 0;
    background: var(--t0);
    color: #fff;
}
.hero.has-video .media-shade {
    background:
        linear-gradient(180deg, rgba(3,20,45,.55) 0%, rgba(3,20,45,.62) 55%, rgba(3,20,45,.82) 100%),
        radial-gradient(70% 60% at 50% 45%, rgba(3,20,45,.35), transparent 75%);
}
.hero.has-video .hero-content { position: relative; z-index: 3; }
.hero.has-video h1 { color: #fff; text-shadow: 0 2px 24px rgba(3,20,45,.45); }
.hero.has-video h1 span { color: #8fd0ff; }
.hero.has-video p { color: rgba(255,255,255,.9); }
.hero.has-video .eyebrow { background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.28); }
.hero.has-video .btn-secondary { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.55); }
.hero.has-video .btn-secondary:hover { background: #fff; color: var(--secondary); border-color: #fff; }
.hero.has-video .media-toggle { bottom: 22px; left: 50%; margin-left: -21px; }

/* One orchestrated page-load moment */
.hero.has-video .hero-content > * { animation: rise .9s cubic-bezier(.2,.7,.2,1) both; }
.hero.has-video .hero-content > :nth-child(1) { animation-delay: .1s; }
.hero.has-video .hero-content > :nth-child(2) { animation-delay: .25s; }
.hero.has-video .hero-content > :nth-child(3) { animation-delay: .4s; }
.hero.has-video .hero-content > :nth-child(4) { animation-delay: .55s; }

/* ---------- Floating CRM activity cards (hero) ---------- */
.floaters {
    position: absolute; top: 0; bottom: 0; left: 0; right: 0;
    margin: 0 auto;
    z-index: 2;
    pointer-events: none;
}
.float-card {
    position: absolute;
    display: flex; align-items: center; gap: 11px;
    padding: 10px 16px 10px 10px;
    background: rgba(255,255,255,.96);
    color: var(--secondary);
    border-radius: 12px;
    box-shadow: 0 18px 40px rgba(3,20,45,.38);
    font-size: 13px; font-weight: 700; line-height: 1.3;
    animation: fadein .8s ease 1.1s both, bob 7s ease-in-out var(--d, 0s) infinite;
}
.float-card small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.float-card i {
    width: 34px; height: 34px;
    display: grid; place-items: center;
    border-radius: 9px;
    background: var(--c, #0176d3);
    color: #fff; font-style: normal; font-size: 16px; font-weight: 800;
}
.float-card.a { top: 30px;    left: 0;  --d: -1s; }
.float-card.b { top: 46px;    right: 0; --d: -3.5s; }
.float-card.c { bottom: 36px; left: 4%; --d: -5s; }
.float-card.d { bottom: 54px; right: 3%; --d: -2s; }

/* ---------- Chips strip ---------- */
.chips-strip {
    overflow: hidden;
    padding: 16px 0;
    background: #fff;
    border-bottom: 1px solid var(--border);
}
.chips-track {
    display: flex; gap: 12px;
    width: max-content;
    animation: scrollx 46s linear infinite;
}
.chips-strip:hover .chips-track { animation-play-state: paused; }
.chip {
    display: inline-flex; align-items: center; gap: 9px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 30px;
    background: var(--light);
    color: var(--secondary);
    font-size: 14px; font-weight: 700;
    white-space: nowrap;
}
.chip::before {
    content: "";
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--c, var(--primary));
}

/* ---------- Video cards ---------- */
.showcase { background: var(--light); }
.video-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.video-grid.single { grid-template-columns: minmax(0, 1000px); justify-content: center; }

.video-card {
    aspect-ratio: 16 / 9;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.video-card::before {
    content: "";
    position: absolute; top: 0; left: 0; right: 0; height: 4px;
    z-index: 3;
    background: var(--hubspot);
}
.video-card[data-tone="salesforce"]::before { background: #1b96ff; }
.video-card:hover .media-video { transform: scale(1.04); }
.video-card .media-shade {
    background: linear-gradient(180deg, transparent 45%, rgba(3,20,45,.88) 100%);
}
.video-caption {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
    padding: 24px 26px;
    color: #fff;
}
.video-caption h3 { font-size: 24px; line-height: 1.2; margin-bottom: 6px; }
.video-caption p { max-width: 520px; color: rgba(255,255,255,.88); font-size: 15px; line-height: 1.55; }
.video-card .media-toggle { top: 16px; right: 16px; }

/* ---------- Journey band (business success video) ---------- */
.journey {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: 105px 0;
    background: var(--secondary);
    color: #fff;
}
.journey .media-shade { background: linear-gradient(180deg, rgba(3,20,45,.8), rgba(3,45,96,.78)); }
.journey > .container { position: relative; z-index: 3; }
.journey .section-header h2 { color: #fff; }
.journey .section-header p { color: rgba(255,255,255,.85); }
.journey .media-toggle { bottom: 20px; right: 20px; }

.journey-steps {
    position: relative;
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px;
}
.journey-steps::before,
.journey-steps::after {
    content: "";
    position: absolute; top: 23px; left: 12.5%; right: 12.5%;
    height: 2px;
}
.journey-steps::before { background: rgba(255,255,255,.22); }
.journey-steps::after {
    background: linear-gradient(90deg, #1b96ff, var(--hubspot));
    transform: scaleX(0); transform-origin: left;
    transition: transform 2.6s ease .3s;
}
.journey.is-live .journey-steps::after { transform: scaleX(1); }

.journey-step { position: relative; padding-top: 62px; text-align: center; }
.journey-step .dot {
    position: absolute; top: 10px; left: 50%;
    width: 26px; height: 26px; margin-left: -13px;
    border-radius: 50%;
    background: #0b3a73;
    border: 2px solid rgba(255,255,255,.4);
    transition: background .4s ease, border-color .4s ease, transform .4s ease;
    transition-delay: calc(var(--i) * .65s + .3s);
}
.journey.is-live .journey-step .dot { background: #1b96ff; border-color: #fff; transform: scale(1.15); }
.journey-step h3 { margin-bottom: 8px; font-size: 20px; color: #fff; }
.journey-step p { max-width: 240px; margin: 0 auto; color: rgba(255,255,255,.82); font-size: 15px; }

/* ---------- Light scroll reveal (video cards only) ---------- */
.js [data-reveal] {
    opacity: 0; transform: translateY(26px);
    transition: opacity .8s ease, transform .8s cubic-bezier(.2,.7,.2,1);
    transition-delay: calc(var(--i, 0) * .14s);
}
.js [data-reveal].is-in { opacity: 1; transform: none; }

.navbar { transition: box-shadow .25s ease; }
.navbar.is-scrolled { box-shadow: 0 8px 28px rgba(3,45,96,.1); }

/* ---------- Keyframes ---------- */
@keyframes drift  { from { background-position: 0% 0%; } to { background-position: 100% 100%; } }
@keyframes rise   { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes bob    { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes scrollx { to { transform: translateX(-50%); } }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
    .float-card { display: none; }
}
@media (max-width: 900px) {
    .video-grid { grid-template-columns: 1fr; }
    .journey-steps { grid-template-columns: repeat(2, 1fr); row-gap: 36px; }
    .journey-steps::before, .journey-steps::after { display: none; }
}
@media (max-width: 650px) {
    .hero.has-video { min-height: 0; padding: 90px 0 100px; }
    .journey { padding: 70px 0; }
    .journey-steps { grid-template-columns: 1fr; }
    .video-caption { padding: 18px; }
    .video-caption h3 { font-size: 20px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .js [data-reveal] { opacity: 1; transform: none; }
    .journey-steps::after { transform: scaleX(1); }
    .journey .journey-step .dot { background: #1b96ff; border-color: #fff; }
    .chips-strip { overflow-x: auto; }
}
