/* ── Landing page components (index.html) ───────────────────────────────────
   Static layout first, then each component's motion, gated behind
   `html.motion` like everything in css/motion.css (which also owns the shared
   keyframes used here: rise-in, pop-in, fade-in, ring-pulse, dash-flow). */

/* ── What Caia does ─────────────────────────────────────────────────────────
   Three jobs listed on the left; on the right Caia works each one on the same
   deal the hero opens with. js/caia-demo.js switches between them. */
.caia-demo {
    --caia-rotate: 5s;
}
.caia-tabs {
    display: flex;
    flex-direction: column;
}
.caia-tab {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 18px;
    width: 100%;
    padding: 22px 0 22px 24px;
    background: none;
    border: 0;
    border-top: 1px solid #dbe3ea;
    text-align: left;
    color: inherit;
    cursor: pointer;
}
.caia-tab:first-child {
    border-top: 0;
}
.caia-tab:focus-visible {
    outline: 2px solid #F3701E;
    outline-offset: 4px;
    border-radius: 6px;
}
/* The track down the left edge, and the fill that marks the active job. */
.caia-tab::before,
.caia-tab-progress {
    content: '';
    position: absolute;
    left: 0;
    top: 22px;
    bottom: 22px;
    width: 3px;
    border-radius: 3px;
}
.caia-tab::before {
    background: #dbe3ea;
}
.caia-tab-progress {
    background: #F3701E;
    transform-origin: top;
    transform: scaleY(0);
}
.caia-tab.is-active .caia-tab-progress {
    transform: scaleY(1);
}
.caia-tab-num {
    font-family: var(--font-accent);
    font-size: 12px;
    letter-spacing: 0.14em;
    color: #94a3b8;
    padding-top: 6px;
}
.caia-tab-title {
    display: block;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.25;
    color: #64748b;
    transition: color 0.2s ease;
}
.caia-tab-desc {
    display: block;
    margin-top: 6px;
    color: #64748b;
}
.caia-tab.is-active .caia-tab-title,
.caia-tab:hover .caia-tab-title {
    color: #233D4D;
}
.caia-tab.is-active .caia-tab-num {
    color: #F3701E;
}

.caia-window {
    background: #ffffff;
    border: 1px solid #dbe3ea;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(35, 61, 77, 0.14);
    overflow: hidden;
}
.caia-window-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #F8FAFC;
    border-bottom: 1px solid #eef2f6;
    font-family: var(--font-accent);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #64748b;
}
.caia-live {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #2F9E8A;
}
.caia-live::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}
/* Tall enough for the longest panel, so switching never moves the page. */
.caia-window-body {
    padding: 22px;
    min-height: 318px;
}
.caia-panel-kicker {
    font-family: var(--font-accent);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #F3701E;
    margin: 0 0 12px;
}
.caia-note {
    background: #F0F4F8;
    border-radius: 12px;
    padding: 12px 14px;
    color: #233D4D;
    font-weight: 600;
}
.caia-line {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    padding: 10px 12px;
    border: 1px solid #eef2f6;
    border-radius: 10px;
    font-size: 0.92rem;
    color: #334155;
}
.caia-line > .bi {
    color: #F3701E;
    flex-shrink: 0;
}
.caia-line-tag {
    margin-left: auto;
    flex-shrink: 0;
    padding: 2px 10px;
    border-radius: 999px;
    background: rgba(47, 158, 138, 0.14);
    color: #1F7F6E;
    font-size: 0.78rem;
    font-weight: 600;
}
.caia-result {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #eef2f6;
    color: #64748b;
    font-size: 0.9rem;
}
.caia-result strong {
    font-size: 1.25rem;
    color: #233D4D;
}
.caia-result s {
    margin-right: 8px;
    font-size: 0.85rem;
    font-weight: 400;
    color: #94a3b8;
}

@keyframes tab-progress {
    from { transform: scaleY(0); }
    to   { transform: scaleY(1); }
}
html.motion .caia-demo.is-inview {
    animation: rise-in 0.65s var(--ease-out) backwards;
}
/* Autoplay: the fill runs down the active job and js/caia-demo.js advances
   when it ends. Hovering or tabbing into the demo holds it; choosing a job
   yourself (.is-manual) stops it for good. */
html.motion .caia-demo.is-inview:not(.is-manual) .caia-tab.is-active .caia-tab-progress {
    animation: tab-progress var(--caia-rotate) linear forwards;
}
html.motion .caia-demo:hover .caia-tab-progress,
html.motion .caia-demo:focus-within .caia-tab-progress {
    animation-play-state: paused;
}
html.motion .caia-panel:not([hidden]) > * {
    animation: rise-in 0.4s var(--ease-out) backwards;
}
html.motion .caia-panel > :nth-child(2) { animation-delay: 80ms; }
html.motion .caia-panel > :nth-child(3) { animation-delay: 160ms; }
html.motion .caia-panel > :nth-child(4) { animation-delay: 240ms; }
html.motion .caia-panel > :nth-child(5) { animation-delay: 320ms; }
html.motion .caia-panel > :nth-child(6) { animation-delay: 420ms; }
html.motion .caia-live::before {
    animation: glow-pulse-teal 2s ease-out infinite;
}
@keyframes glow-pulse-teal {
    0%   { box-shadow: 0 0 0 0 rgba(47, 158, 138, 0.5); }
    70%  { box-shadow: 0 0 0 7px rgba(47, 158, 138, 0); }
    100% { box-shadow: 0 0 0 0 rgba(47, 158, 138, 0); }
}

/* ── The rollout: Integrate · Activate · Expand ─────────────────────────────
   One tinted panel per phase, stacked until xl, then three across with each
   panel pointing at the next. */
.rollout-col {
    --stage: #233D4D;
    --tint: #E3ECF7;
    --wire: #9DB7DE;
}
.rollout-col--activate {
    --stage: #F3701E;
    --tint: #FDE8D9;
}
.rollout-col--expand {
    --stage: #2F9E8A;
    --tint: #DDF3EC;
    --wire: #8CCBBD;
}
.rollout-panel {
    position: relative;
    z-index: 0;
    min-height: 270px;
    padding: 26px 24px 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.rollout-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--tint);
    border-radius: 18px;
}
.rollout-card {
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(35, 61, 77, 0.08);
}
.rollout-wires {
    flex-shrink: 0;
    overflow: visible;
}
.rollout-wires path {
    fill: none;
    stroke: var(--wire);
    stroke-width: 1.5;
    stroke-dasharray: 3 4;
}
/* A packet riding each wire; only drawn when motion is on. */
.rollout-wires .rollout-packet {
    stroke: var(--stage);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 7 100;
    stroke-dashoffset: 107;
    opacity: 0;
}

/* 1 · Integrate */
.rollout-crm {
    list-style: none;
    margin: 0;
    padding: 6px 12px;
    width: 150px;
    flex-shrink: 0;
}
.rollout-crm li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 0;
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.25;
    color: #233D4D;
}
.rollout-crm li + li {
    border-top: 1px solid #eef2f6;
}
.rollout-crm .bi {
    color: #2F9E8A;
    font-size: 0.95rem;
}
.rollout-crm .rollout-crm-more {
    justify-content: center;
    font-weight: 500;
    color: #64748b;
}

/* 2 · Activate */
.rollout-activate {
    width: 100%;
    max-width: 320px;
    display: grid;
    gap: 10px;
}
.rollout-steps {
    position: relative;
    list-style: none;
    margin: 0;
    padding: 8px 14px;
}
.rollout-steps::before {
    content: '';
    position: absolute;
    left: 23px;
    top: 22px;
    bottom: 22px;
    width: 2px;
    background: #e2e8f0;
}
.rollout-steps li {
    --i: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
    font-size: 0.88rem;
    color: #64748b;
}
.rollout-steps li:nth-child(2) { --i: 1; }
.rollout-steps li:nth-child(3) { --i: 2; }
.rollout-steps li:nth-child(4) { --i: 3; }
.rollout-steps li:nth-child(5) { --i: 4; }
.rollout-steps li::before {
    content: '';
    position: relative;
    z-index: 1;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #eef2f6;
    border: 3px solid #ffffff;
    box-shadow: 0 0 0 1px #dbe3ea;
}
/* Without motion the first stage simply stays lit. */
html:not(.motion) .rollout-steps li:first-child {
    color: #233D4D;
}
html:not(.motion) .rollout-steps li:first-child::before {
    background: var(--stage);
    box-shadow: 0 0 0 1px var(--stage);
}
.rollout-coach {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
}
.rollout-coach p {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.4;
    color: #233D4D;
}
.rollout-wave {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 20px;
    flex-shrink: 0;
}
.rollout-wave span {
    width: 3px;
    height: 100%;
    border-radius: 2px;
    background: var(--stage);
    transform: scaleY(0.4);
}
.rollout-wave span:nth-child(2) { transform: scaleY(0.9); }
.rollout-wave span:nth-child(3) { transform: scaleY(0.6); }
.rollout-wave span:nth-child(4) { transform: scaleY(1); }

/* 3 · Expand */
.rollout-hub {
    position: relative;
    display: flex;
    padding: 10px;
    border-radius: 50%;
    background: rgba(47, 158, 138, 0.18);
    box-shadow: 0 0 0 12px rgba(47, 158, 138, 0.09);
    flex-shrink: 0;
}
.rollout-outcomes {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.rollout-outcomes li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 16px 6px 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.8);
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.2;
    color: #233D4D;
}
.rollout-outcome-icon {
    --outcome: #2F9E8A;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--outcome);
    color: #ffffff;
    font-size: 16px;
}
.rollout-outcome-icon--resell { --outcome: #3A7BD5; }
.rollout-outcome-icon--grow   { --outcome: #7A5BD1; }

/* The numbered caption sits across the panel's bottom edge. */
.rollout-caption {
    text-align: center;
}
.rollout-num {
    position: relative;
    z-index: 1;
    width: 60px;
    height: 60px;
    margin: -30px auto 0;
    border-radius: 50%;
    background: var(--stage);
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 5px #ffffff, 0 12px 24px rgba(35, 61, 77, 0.18);
}
.rollout-title {
    font-size: 1.75rem;
    margin: 18px 0 8px;
}
.rollout-caption p {
    max-width: 280px;
    margin: 0 auto;
    color: #64748b;
}
.flow-chevron {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: -20px;
    color: #94a3b8;
    font-size: 22px;
    line-height: 1;
}

@media (max-width: 1199.98px) {
    .rollout-col {
        max-width: 560px;
        margin-left: auto;
        margin-right: auto;
    }
}
@media (min-width: 1200px) {
    /* Panels size to their own content, but stay level across the row so the
       numbered captions below them line up. */
    .rollout-col {
        display: flex;
        flex-direction: column;
    }
    .rollout-col > .position-relative {
        display: flex;
        flex: 1 1 auto;
    }
    .rollout-panel {
        width: 100%;
        padding-right: 42px;
    }
    .rollout-panel::before {
        border-radius: 18px 0 0 18px;
        clip-path: polygon(0 0, calc(100% - 24px) 0, 100% 50%, calc(100% - 24px) 100%, 0 100%);
    }
    /* Reserve two lines for every caption so the row ends on one baseline. */
    .rollout-caption p {
        min-height: 3.2rem;
    }
}

@keyframes packet {
    from { stroke-dashoffset: 107; }
    to   { stroke-dashoffset: 0; }
}
@keyframes wave {
    0%, 100% { transform: scaleY(0.3); }
    50%      { transform: scaleY(1); }
}
/* One lap is all five stages; each is lit for its own fifth of it. */
@keyframes step-label {
    0%, 19%   { color: #233D4D; }
    21%, 100% { color: #64748b; }
}
@keyframes step-dot {
    0%, 19%   { background: #F3701E; box-shadow: 0 0 0 1px #F3701E, 0 0 0 6px rgba(243, 112, 30, 0.18); }
    21%, 100% { background: #eef2f6; box-shadow: 0 0 0 1px #dbe3ea; }
}
html.motion .rollout-wires path {
    animation: dash-flow 1.1s linear infinite;
}
html.motion .rollout-wires .rollout-packet {
    opacity: 1;
    animation: packet 2.4s ease-in-out infinite;
}
html.motion .rollout-wires .rollout-packet:nth-of-type(5) { animation-delay: 0.8s; }
html.motion .rollout-wires .rollout-packet:nth-of-type(6) { animation-delay: 1.6s; }
html.motion .rollout-steps li {
    animation: step-label 10s linear calc(var(--i) * 2s) infinite;
}
html.motion .rollout-steps li::before {
    animation: step-dot 10s linear calc(var(--i) * 2s) infinite;
}
html.motion .rollout-wave span {
    animation: wave 1s ease-in-out infinite;
}
html.motion .rollout-wave span:nth-child(2) { animation-delay: 0.15s; }
html.motion .rollout-wave span:nth-child(3) { animation-delay: 0.3s; }
html.motion .rollout-wave span:nth-child(4) { animation-delay: 0.45s; }
html.motion .rollout-hub::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--stage);
    pointer-events: none;
    animation: ring-pulse 2.8s ease-out infinite;
}
/* As each phase arrives: its badge pops, then its details tick in. */
html.motion .rollout-col.is-inview .rollout-num {
    animation: pop-in 0.5s var(--ease-spring) calc(var(--reveal-delay, 0ms) + 350ms) backwards;
}
html.motion .rollout-col.is-inview .rollout-crm .bi,
html.motion .rollout-col.is-inview .rollout-outcomes li {
    animation: pop-in 0.4s var(--ease-spring) calc(var(--reveal-delay, 0ms) + 600ms) backwards;
}
html.motion .rollout-col.is-inview .rollout-crm li:nth-child(2) .bi,
html.motion .rollout-col.is-inview .rollout-outcomes li:nth-child(2) {
    animation-delay: calc(var(--reveal-delay, 0ms) + 760ms);
}
html.motion .rollout-col.is-inview .rollout-crm li:nth-child(3) .bi,
html.motion .rollout-col.is-inview .rollout-outcomes li:nth-child(3) {
    animation-delay: calc(var(--reveal-delay, 0ms) + 920ms);
}
