/* ==========================================================================
   Animated service embeds inside article text
   View: resources/views/front/blog/partials/service-embed.blade.php
   Variants: .km-svc--card, .km-svc--banner, .km-svc--grid
   All motion is switched off for prefers-reduced-motion.
   ========================================================================== */
.km-svc {
    --svc-brand: #00aeef;
    --svc-brand-2: #2563eb;
    --svc-ink: #0f172a;
    --svc-muted: #64748b;
    --svc-line: #e2e8f0;
    position: relative;
    display: block;
    margin: 1.75rem 0;
    direction: rtl;
    text-align: right;
    text-decoration: none !important;
    container: km-svc / inline-size;
}
.km-svc *,
.km-svc *::before,
.km-svc *::after { box-sizing: border-box; }
.km-svc a,
.km-svc a:hover,
a.km-svc,
a.km-svc:hover { text-decoration: none !important; }
.km-svc p { margin: 0 !important; text-align: right !important; }

.km-svc__dot {
    position: relative;
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #22c55e;
}
.km-svc__dot::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: inherit;
    animation: km-svc-ping 1.8s cubic-bezier(0, 0, .2, 1) infinite;
}

/* ---- Scroll reveal (set by the inline script) ---- */
.km-svc.is-pending { opacity: 0; transform: translateY(18px); }
.km-svc.is-in { animation: km-svc-rise .7s cubic-bezier(.2, .8, .2, 1) both; }

/* ==========================================================================
   1) Card
   ========================================================================== */
.km-svc--card {
    padding: 2px;
    border-radius: 22px;
    background: conic-gradient(from var(--svc-angle, 0deg), var(--svc-brand), #a855f7, var(--svc-brand-2), #22d3ee, var(--svc-brand));
    animation: km-svc-spin 8s linear infinite;
    box-shadow: 0 24px 50px -28px rgba(37, 99, 235, .55);
}
.km-svc--card.is-in { animation: km-svc-rise .7s cubic-bezier(.2, .8, .2, 1) both, km-svc-spin 8s linear infinite; }
.km-svc-card {
    display: grid;
    grid-template-columns: 1fr;
    overflow: hidden;
    border-radius: 20px;
    background: #fff;
}
@container km-svc (min-width: 560px) {
    .km-svc-card { grid-template-columns: 40% 1fr; }
}
.km-svc-card__media {
    position: relative;
    min-height: 11rem;
    overflow: hidden;
    background: #eff6ff;
}
.km-svc-card__media img {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    object-fit: cover;
    border-radius: 0 !important;
    box-shadow: none !important;
    animation: km-svc-kenburns 14s ease-in-out infinite alternate;
}
.km-svc-card__media::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(200deg, transparent 40%, rgba(15, 23, 42, .35));
}
.km-svc-card__discount {
    position: absolute;
    z-index: 1;
    top: .75rem;
    right: .75rem;
    padding: .25rem .7rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #f43f5e, #f97316);
    box-shadow: 0 8px 18px -6px rgba(244, 63, 94, .7);
    animation: km-svc-pulse 2.2s ease-in-out infinite;
}
.km-svc-card__body {
    display: flex;
    flex-direction: column;
    gap: .65rem;
    padding: 1.1rem 1.2rem 1.25rem;
}
.km-svc-card__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .75rem;
    font-weight: 700;
    color: #16a34a;
}
.km-svc-card__head { display: flex; align-items: center; gap: .7rem; }
.km-svc-card__icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.1rem;
    height: 3.1rem;
    border-radius: 15px;
    background: linear-gradient(135deg, #e0f2fe, #ede9fe);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .12);
    animation: km-svc-float 3.6s ease-in-out infinite;
}
.km-svc-card__icon img {
    width: 2rem !important;
    height: 2rem !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}
.km-svc-card__title {
    font-size: 1.12rem !important;
    font-weight: 900 !important;
    line-height: 1.6 !important;
    color: var(--svc-ink) !important;
}
.km-svc-card__desc {
    font-size: .88rem !important;
    line-height: 1.9 !important;
    color: var(--svc-muted) !important;
}
.km-svc-card__points {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem .9rem;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}
.km-svc-card__points li {
    position: relative;
    margin: 0 !important;
    padding-right: 1.25rem;
    font-size: .8rem;
    font-weight: 600;
    color: #334155;
}
.km-svc-card__points li::before {
    content: "✓";
    position: absolute;
    right: 0;
    top: 0;
    font-weight: 900;
    color: #16a34a;
}
.km-svc-card__cta {
    position: relative;
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin-top: .2rem;
    padding: .7rem 1.25rem;
    overflow: hidden;
    border-radius: 14px;
    font-size: .9rem;
    font-weight: 800;
    color: #fff !important;
    background: linear-gradient(135deg, var(--svc-brand), var(--svc-brand-2));
    box-shadow: 0 12px 24px -10px rgba(37, 99, 235, .75);
    transition: transform .2s ease, box-shadow .2s ease;
}
.km-svc-card__cta::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 45%;
    left: -60%;
    background: linear-gradient(110deg, transparent, rgba(255, 255, 255, .55), transparent);
    transform: skewX(-20deg);
    animation: km-svc-shine 3.2s ease-in-out infinite;
}
.km-svc-card__cta:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -10px rgba(37, 99, 235, .85); }
.km-svc-card__cta-arrow { display: inline-block; animation: km-svc-nudge 1.4s ease-in-out infinite; }

/* ==========================================================================
   2) Banner
   ========================================================================== */
.km-svc--banner {
    padding: .85rem 1rem;
    overflow: hidden;
    border-radius: 18px;
    color: #fff !important;
    background: linear-gradient(120deg, #0284c7, #2563eb, #7c3aed, #0284c7);
    background-size: 300% 100%;
    animation: km-svc-flow 9s ease-in-out infinite;
    box-shadow: 0 18px 36px -20px rgba(37, 99, 235, .8);
}
.km-svc--banner.is-in { animation: km-svc-rise .7s cubic-bezier(.2, .8, .2, 1) both, km-svc-flow 9s ease-in-out infinite; }
.km-svc--banner::before {
    content: "";
    position: absolute;
    width: 180px;
    height: 180px;
    left: -40px;
    top: -90px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(255, 255, 255, .28), transparent 70%);
    animation: km-svc-float 6s ease-in-out infinite;
    pointer-events: none;
}
.km-svc-banner__inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: .85rem;
}
.km-svc-banner__icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, .95);
    box-shadow: 0 8px 16px -8px rgba(15, 23, 42, .5);
    animation: km-svc-bob 2.6s ease-in-out infinite;
}
.km-svc-banner__icon img {
    width: 1.9rem !important;
    height: 1.9rem !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}
.km-svc-banner__text { display: flex; flex-direction: column; gap: .1rem; min-width: 0; flex: 1; }
.km-svc-banner__q { font-size: .98rem; font-weight: 900; line-height: 1.6; color: #fff; }
.km-svc-banner__sub { font-size: .76rem; line-height: 1.6; color: rgba(255, 255, 255, .85); }
.km-svc-banner__cta {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem .95rem;
    border-radius: 12px;
    font-size: .82rem;
    font-weight: 800;
    color: #1d4ed8;
    background: #fff;
    box-shadow: 0 8px 18px -10px rgba(15, 23, 42, .6);
}
.km-svc-banner__arrow { display: inline-block; animation: km-svc-nudge 1.4s ease-in-out infinite; }
@container km-svc (max-width: 420px) {
    .km-svc-banner__inner { flex-wrap: wrap; }
    .km-svc-banner__text { flex: 1 1 calc(100% - 4rem); }
    .km-svc-banner__cta { width: 100%; justify-content: center; }
}

/* ==========================================================================
   3) Grid of mini cards
   Spacing uses flex/grid gap (not margins): .km-svc p { margin:0 !important } would eat margins.
   ========================================================================== */
.km-svc--grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.1rem;
    border-radius: 22px;
    background:
        radial-gradient(28rem 12rem at 100% 0%, rgba(0, 174, 239, .14), transparent 70%),
        radial-gradient(22rem 10rem at 0% 100%, rgba(124, 58, 237, .10), transparent 70%),
        linear-gradient(180deg, #f8fbff, #f3f6ff);
    box-shadow: inset 0 0 0 1px #dbeafe, 0 18px 40px -30px rgba(37, 99, 235, .6);
}

/* ---- Header ---- */
.km-svc-grid__head {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding-bottom: .85rem;
    border-bottom: 1px dashed rgba(37, 99, 235, .22);
}
.km-svc-grid__badge {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 14px;
    font-size: 1.05rem;
    color: #fff;
    background: linear-gradient(135deg, var(--svc-brand), #7c3aed);
    box-shadow: 0 10px 20px -10px rgba(124, 58, 237, .8);
    animation: km-svc-float 3.6s ease-in-out infinite;
}
.km-svc-grid__heading { display: flex; flex-direction: column; gap: .1rem; min-width: 0; flex: 1; }
.km-svc-grid__title { font-size: 1rem; font-weight: 900; line-height: 1.6; color: var(--svc-ink); }
.km-svc-grid__sub { font-size: .76rem; line-height: 1.6; color: var(--svc-muted); }
.km-svc-grid__count {
    flex-shrink: 0;
    padding: .2rem .65rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 800;
    color: #4f46e5;
    background: rgba(99, 102, 241, .1);
}

/* ---- Cards ---- */
.km-svc__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: .6rem;
}
@container km-svc (min-width: 440px) {
    .km-svc__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container km-svc (min-width: 660px) {
    .km-svc__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* accent per card (cycles through 6 colours) */
.km-svc-mini { --c: 14, 165, 233; }
.km-svc-mini:nth-child(6n + 2) { --c: 139, 92, 246; }
.km-svc-mini:nth-child(6n + 3) { --c: 16, 185, 129; }
.km-svc-mini:nth-child(6n + 4) { --c: 245, 158, 11; }
.km-svc-mini:nth-child(6n + 5) { --c: 236, 72, 153; }
.km-svc-mini:nth-child(6n + 6) { --c: 59, 130, 246; }

.km-svc-mini {
    position: relative;
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .7rem .75rem;
    border-radius: 16px;
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .06), 0 4px 14px -10px rgba(15, 23, 42, .3);
    transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s ease;
}
.km-svc.is-in .km-svc-mini { animation: km-svc-rise .55s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 80ms + 120ms); }
.km-svc-mini:hover {
    transform: translateY(-3px);
    box-shadow: inset 0 0 0 1.5px rgba(var(--c), .55), 0 14px 26px -14px rgba(var(--c), .7);
}
.km-svc-mini__icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 14px;
    background: rgba(var(--c), .12);
    transition: transform .3s ease, background-color .3s ease;
}
.km-svc-mini:hover .km-svc-mini__icon { transform: rotate(-8deg) scale(1.06); background: rgba(var(--c), .2); }
.km-svc-mini__icon img {
    width: 1.75rem !important;
    height: 1.75rem !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}
.km-svc-mini__body { display: flex; flex-direction: column; gap: .2rem; min-width: 0; flex: 1; }
.km-svc-mini__title {
    font-size: .86rem;
    font-weight: 800;
    line-height: 1.55;
    color: var(--svc-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.km-svc-mini__meta { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.km-svc-mini__link { font-size: .72rem; font-weight: 700; color: rgb(var(--c)); }
.km-svc-mini__badge {
    padding: .02rem .45rem;
    border-radius: 999px;
    font-size: .66rem;
    font-weight: 800;
    color: #e11d48;
    background: #ffe4e6;
}
.km-svc-mini__arrow {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 900;
    color: rgb(var(--c));
    background: rgba(var(--c), .1);
    transition: background-color .2s ease, color .2s ease, transform .2s ease;
}
.km-svc-mini:hover .km-svc-mini__arrow { color: #fff; background: rgb(var(--c)); transform: translateX(-3px); }

@container km-svc (max-width: 380px) {
    .km-svc-grid__count { display: none; }
}

/* ==========================================================================
   Keyframes
   ========================================================================== */
@property --svc-angle {
    syntax: "<angle>";
    inherits: false;
    initial-value: 0deg;
}
@keyframes km-svc-spin { to { --svc-angle: 360deg; } }
@keyframes km-svc-rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes km-svc-kenburns { from { transform: scale(1); } to { transform: scale(1.12) translate(-2%, 2%); } }
@keyframes km-svc-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes km-svc-bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-4px) rotate(-6deg); } }
@keyframes km-svc-nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-5px); } }
@keyframes km-svc-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes km-svc-shine { 0% { left: -60%; } 55%, 100% { left: 130%; } }
@keyframes km-svc-flow { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes km-svc-ping { 75%, 100% { transform: scale(2.4); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
    .km-svc,
    .km-svc *,
    .km-svc *::before,
    .km-svc *::after {
        animation: none !important;
        transition: none !important;
    }
    .km-svc.is-pending { opacity: 1; transform: none; }
}
