/* ==========================================================================
   "Included in Every Engagement" (engagement.html #included) - interactive cards
   - a spotlight moves from card to card (paused while the visitor hovers, taps or
     tabs to a card); the active card lifts, glows and plays its icon animation
   - 3D tilt towards the cursor and a soft glow that follows it
   - a gold "included" track runs through the cards; each card gets a tick
   Script: assets/js/included.js. Everything is scoped to #included.
   ========================================================================== */

#included {
    --inc-gold: #C9A438;
    --inc-gold-hi: #E7CF86;
    --inc-gold-deep: #A7832A;
    --inc-navy: #111A2E;
    --inc-ink: #111A2E;
    --inc-text: #64748B;
    --inc-card: #FFFFFF;
    --inc-line: rgba(17, 26, 46, 0.08);
    --inc-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --inc-grad: linear-gradient(135deg, #E7CF86 0%, #C9A438 55%, #A7832A 100%);
}

html.dark-mode #included {
    --inc-ink: #F1F5F9;
    --inc-text: #AAB8CA;
    --inc-card: #121D33;
    --inc-line: rgba(255, 255, 255, 0.08);
}

#included .inc-wrap {
    position: relative;
}

#included .inc-grid {
    position: relative;
    z-index: 1;
    gap: clamp(1.25rem, 2.2vw, 2.25rem);
    margin-top: clamp(2.5rem, 5vw, 4rem);
    perspective: 1100px;
}

/* ---------- Gold "included" track (only when the cards sit in one row) ---------- */
#included .inc-track {
    position: absolute;
    z-index: 0;
    left: var(--track-l, 0);
    width: var(--track-w, 0);
    top: var(--track-y, 0);
    height: 2px;
    border-radius: 2px;
    background: repeating-linear-gradient(90deg, rgba(201, 164, 56, 0.35) 0 8px, transparent 8px 16px);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

#included .inc-wrap.has-track .inc-track {
    opacity: 1;
}

#included .inc-track-fill {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--inc-grad);
    box-shadow: 0 0 12px rgba(201, 164, 56, 0.55);
    transform-origin: left center;
    transform: scaleX(var(--track-fill, 0));
    transition: transform 0.9s var(--inc-ease);
}

/* ---------- Card ---------- */
#included .inc-card {
    --rx: 0deg;
    --ry: 0deg;
    --lift: 0px;
    --mx: 50%;
    --my: 0%;
    isolation: isolate;
    padding: clamp(2.2rem, 3vw, 3rem) clamp(1.4rem, 2vw, 2rem) clamp(2rem, 2.6vw, 2.6rem);
    border-radius: 24px;
    border: 1px solid var(--inc-line);
    background:
        radial-gradient(240px 130px at 50% 0%, rgba(201, 164, 56, 0.08), transparent 70%),
        var(--inc-card);
    box-shadow: 0 1px 2px rgba(17, 26, 46, 0.04), 0 18px 40px -26px rgba(17, 26, 46, 0.35);
    transform: translateY(var(--lift)) rotateX(var(--rx)) rotateY(var(--ry));
    transform-style: preserve-3d;
    transition: transform 0.5s var(--inc-ease), box-shadow 0.5s var(--inc-ease), border-color 0.35s ease;
    cursor: pointer;
    outline: none;
}

/* glow that follows the cursor */
#included .inc-card::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background: radial-gradient(260px circle at var(--mx) var(--my), rgba(201, 164, 56, 0.16), transparent 65%);
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
}

/* gold hairline across the top */
#included .inc-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 46%;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--inc-grad);
    transform: translateX(-50%) scaleX(0.3);
    opacity: 0.6;
    transition: transform 0.55s var(--inc-ease), opacity 0.35s ease, width 0.55s var(--inc-ease);
}

#included .inc-card.is-active {
    --lift: -10px;
    border-color: rgba(201, 164, 56, 0.6);
    box-shadow:
        0 2px 4px rgba(17, 26, 46, 0.05),
        0 32px 60px -28px rgba(17, 26, 46, 0.5),
        0 0 0 4px rgba(201, 164, 56, 0.1);
}

#included .inc-card.is-active::before {
    width: 100%;
    transform: translateX(-50%) scaleX(1);
    opacity: 1;
}

#included .inc-card.is-active::after,
#included .inc-card:hover::after {
    opacity: 1;
}

#included .inc-card:focus-visible {
    outline: 2px solid var(--inc-gold);
    outline-offset: 4px;
}

/* ---------- Icon tile ---------- */
#included .inc-icon {
    width: 84px;
    height: 84px;
    margin-bottom: 1.6rem;
    border-radius: 22px;
    background: rgba(201, 164, 56, 0.1);
    color: var(--inc-gold-deep);
    transform: translateZ(30px);
    transition: background 0.45s var(--inc-ease), color 0.35s ease, border-radius 0.45s var(--inc-ease), transform 0.45s var(--inc-ease), box-shadow 0.45s ease;
}

#included .inc-card.is-active .inc-icon {
    background: var(--inc-grad);
    color: var(--inc-navy);
    border-radius: 50%;
    transform: translateZ(30px) scale(1.06);
    box-shadow: 0 14px 28px -12px rgba(167, 131, 42, 0.85);
}

#included .inc-svg {
    width: 44px;
    height: 44px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
    overflow: visible;
}

/* the site-wide rule that strips SVG strokes must not touch these */
#included .inc-svg path,
#included .inc-svg rect,
#included .inc-svg circle {
    stroke: currentColor !important;
    fill: none;
}

/* phone: rings (shakes) and the signal waves pulse out */
#included .inc-phone { transform-origin: 20px 26px; }
#included .inc-wave { opacity: 0.35; }

#included .inc-card.is-active .inc-phone { animation: incRing 1.6s ease-in-out infinite; }
#included .inc-card.is-active .inc-wave-1 { animation: incWave 1.6s ease-out infinite; }
#included .inc-card.is-active .inc-wave-2 { animation: incWave 1.6s ease-out 0.25s infinite; }

@keyframes incRing {
    0%, 55%, 100% { transform: rotate(0); }
    8%, 24%, 40% { transform: rotate(-12deg); }
    16%, 32%, 48% { transform: rotate(10deg); }
}

@keyframes incWave {
    0% { opacity: 0; }
    30% { opacity: 1; }
    100% { opacity: 0.2; }
}

/* lock: the shackle lifts open, the keyhole glows */
#included .inc-shackle {
    transform-origin: 32px 21px;
    transition: transform 0.55s var(--inc-ease);
}

#included .inc-card.is-active .inc-shackle {
    transform: translate(0, -4px) rotate(22deg);
}

#included .inc-card.is-active .inc-key {
    animation: incBlink 1.4s ease-in-out infinite;
}

@keyframes incBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

/* chart: the bars grow, the trend line draws, the arrow pops */
#included .inc-bar {
    opacity: 0.45;
    transform-origin: 50% 34px;
    transition: transform 0.6s var(--inc-ease), opacity 0.4s ease;
}

#included .inc-line {
    stroke-dasharray: 1;
    stroke-dashoffset: 0;
}

#included .inc-arrow {
    transition: transform 0.5s var(--inc-ease);
}

#included .inc-card.is-active .inc-bar {
    opacity: 0.8;
    animation: incBars 1.8s var(--inc-ease) infinite;
}

#included .inc-card.is-active .inc-line {
    animation: incDraw 1.8s var(--inc-ease) infinite;
}

#included .inc-card.is-active .inc-arrow {
    animation: incArrow 1.8s var(--inc-ease) infinite;
}

@keyframes incBars {
    0% { transform: scaleY(0.4); }
    45%, 100% { transform: scaleY(1); }
}

@keyframes incDraw {
    0% { stroke-dashoffset: 1; }
    55%, 100% { stroke-dashoffset: 0; }
}

@keyframes incArrow {
    0%, 45% { transform: translate(-3px, 3px); opacity: 0; }
    60%, 100% { transform: translate(0, 0); opacity: 1; }
}

/* bulb: lights up with rays */
#included .inc-rays {
    opacity: 0;
    transition: opacity 0.4s ease;
}

#included .inc-card.is-active .inc-rays {
    animation: incRays 1.6s ease-in-out infinite;
}

#included .inc-card.is-active .inc-glass {
    fill: rgba(255, 255, 255, 0.45) !important;
}

@keyframes incRays {
    0%, 100% { opacity: 0.35; }
    50% { opacity: 1; }
}

/* ---------- Text ---------- */
#included .inc-card h3 {
    margin-bottom: 0.75rem;
    font-size: clamp(1.15rem, 1.4vw, 1.35rem);
    color: var(--inc-ink);
    transform: translateZ(20px);
}

#included .inc-card p {
    color: var(--inc-text);
    font-size: 0.93rem;
    transform: translateZ(14px);
}

/* key point chip */
#included .inc-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 1.2rem;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid rgba(201, 164, 56, 0.35);
    background: rgba(201, 164, 56, 0.08);
    color: var(--inc-gold-deep);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transform: translateZ(18px);
    transition: background 0.4s ease, color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

#included .inc-chip::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

#included .inc-card.is-active .inc-chip {
    background: var(--inc-navy);
    border-color: var(--inc-navy);
    color: var(--inc-gold-hi);
    box-shadow: 0 8px 18px -10px rgba(17, 26, 46, 0.8);
}

/* big outlined number in the corner */
#included .inc-num {
    position: absolute;
    left: 18px;
    top: 12px;
    font-family: var(--font-heading);
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1;
    color: transparent;
    -webkit-text-stroke: 1px rgba(201, 164, 56, 0.35);
    transition: -webkit-text-stroke-color 0.4s ease, transform 0.5s var(--inc-ease);
    pointer-events: none;
}

#included .inc-card.is-active .inc-num {
    -webkit-text-stroke-color: rgba(201, 164, 56, 0.9);
    transform: translateY(-2px);
}

/* "included" tick badge */
#included .inc-check {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--inc-grad);
    box-shadow: 0 6px 14px -6px rgba(167, 131, 42, 0.9);
    transform: scale(0);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#included .inc-check svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: var(--inc-navy) !important;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 24;
    stroke-dashoffset: 24;
    transition: stroke-dashoffset 0.45s ease 0.2s;
}

#included .inc-check svg path {
    stroke: var(--inc-navy) !important;
}

#included .inc-card.is-ticked .inc-check {
    transform: scale(1);
}

#included .inc-card.is-ticked .inc-check svg {
    stroke-dashoffset: 0;
}

/* ---------- Entrance (only once the script is running) ---------- */
#included .inc-grid.inc-ready .inc-card {
    opacity: 0;
    transform: translateY(28px);
}

#included .inc-grid.inc-ready .inc-card.is-in {
    opacity: 1;
    transform: translateY(var(--lift)) rotateX(var(--rx)) rotateY(var(--ry));
    transition: opacity 0.7s var(--inc-ease) calc(var(--i, 0) * 0.12s), transform 0.7s var(--inc-ease) calc(var(--i, 0) * 0.12s), box-shadow 0.5s var(--inc-ease), border-color 0.35s ease;
}

#included .inc-grid.inc-ready .inc-card.is-in.is-settled {
    transition: transform 0.5s var(--inc-ease), box-shadow 0.5s var(--inc-ease), border-color 0.35s ease;
}

/* ---------- Dark mode ---------- */
html.dark-mode body.dark-mode #included .inc-card {
    background:
        radial-gradient(240px 130px at 50% 0%, rgba(201, 164, 56, 0.12), transparent 70%),
        linear-gradient(160deg, #15223B 0%, #0F192D 100%);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.8);
    backdrop-filter: none;
}

html.dark-mode body.dark-mode #included .inc-card.is-active {
    border-color: rgba(201, 164, 56, 0.6);
    box-shadow: 0 30px 60px -28px rgba(0, 0, 0, 0.9), 0 0 0 4px rgba(201, 164, 56, 0.12), 0 0 40px -12px rgba(201, 164, 56, 0.35);
}

html.dark-mode body.dark-mode #included .inc-icon {
    background: rgba(201, 164, 56, 0.12);
    color: var(--inc-gold-hi);
}

html.dark-mode body.dark-mode #included .inc-card.is-active .inc-icon {
    background: var(--inc-grad);
    color: var(--inc-navy);
}

html.dark-mode body.dark-mode #included .inc-card h3 {
    color: #F1F5F9 !important;
}

html.dark-mode body.dark-mode #included .inc-card p {
    color: #C2CDDB !important;
}

/* the site-wide dark theme forces a light colour on text; keep these exact */
html.dark-mode body.dark-mode #included .inc-chip {
    color: var(--inc-gold-hi) !important;
    -webkit-text-fill-color: var(--inc-gold-hi) !important;
}

html.dark-mode body.dark-mode #included .inc-card.is-active .inc-chip {
    background: var(--inc-gold);
    border-color: var(--inc-gold);
    color: var(--inc-navy) !important;
    -webkit-text-fill-color: var(--inc-navy) !important;
}

html.dark-mode body.dark-mode #included .inc-num {
    color: transparent !important;
    -webkit-text-fill-color: transparent !important;
}

/* ---------- Touch screens: no tilt, keep things calm ---------- */
@media (hover: none) {
    #included .inc-card {
        --rx: 0deg !important;
        --ry: 0deg !important;
    }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    #included .inc-card,
    #included .inc-card *,
    #included .inc-card::before,
    #included .inc-track-fill {
        animation: none !important;
        transition: none !important;
    }

    #included .inc-grid.inc-ready .inc-card {
        opacity: 1;
        transform: none;
    }
}
