/* ──────────────────────────────────────────────────────────
   CATEGORIES SECTION – Flip Grid + Animated BG
   ────────────────────────────────────────────────────────── */
.sp-categories-section {
    position: relative;
    padding: 3.5rem 0 2.5rem;
    background: #f8fbff;
    overflow: hidden;
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
}

.sp-categories-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(at 100% 100%, rgba(0, 71, 255, 0.04) 0px, transparent 40%),
        radial-gradient(at 0% 40%, rgba(200, 100, 255, 0.05) 0px, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ── Background Animated Elements ── */
.sp-cats-bg-elements {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.sp-cats-sphere-wrap {
    position: absolute;
    z-index: 1;
}

.sphere-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: absolute;
    top: 0; left: 0;
    z-index: 2;
}

.sphere-glow {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 150%; height: 150%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(200, 150, 255, 0.5) 0%, transparent 60%);
    filter: blur(25px);
    z-index: -1;
    animation: glowPulse 6s ease-in-out infinite;
}

.sphere-shadow {
    position: absolute;
    bottom: -15%;
    left: 20%;
    width: 60%;
    height: 25%;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(100, 50, 200, 0.15) 0%, transparent 70%);
    filter: blur(8px);
    z-index: 0;
    animation: shadowScale 12s ease-in-out infinite;
}

.sp-cats-sphere-wrap.sphere-1 {
    width: 280px; height: 280px;
    left: -100px; top: 15%;
    animation: floatSphere1 14s ease-in-out infinite;
}
.sp-cats-sphere-wrap.sphere-1 .sphere-inner {
    background: radial-gradient(circle at 35% 35%, #ffffff 0%, #fcf7ff 15%, #f1dcff 40%, #e2b3ff 75%, #c581ff 100%);
    box-shadow:
        inset -15px -25px 40px rgba(110, 40, 255, 0.25),
        inset 15px 15px 25px rgba(255, 255, 255, 0.9),
        10px 20px 40px rgba(0,0,0,0.06);
}

.sp-cats-sphere-wrap.sphere-2 {
    width: 110px; height: 110px;
    left: 130px; top: 58%;
    animation: floatSphere2 18s ease-in-out infinite;
}
.sp-cats-sphere-wrap.sphere-2 .sphere-inner {
    background: radial-gradient(circle at 35% 35%, #ffffff 0%, #f5f3ff 20%, #ddd6fe 60%, #a78bfa 100%);
    box-shadow:
        inset -10px -15px 20px rgba(99, 102, 241, 0.3),
        inset 10px 10px 15px rgba(255, 255, 255, 0.9),
        5px 10px 20px rgba(0,0,0,0.05);
}
.sp-cats-sphere-wrap.sphere-2 .sphere-shadow { animation-duration: 18s; }

.sp-cats-sphere-wrap.sphere-3 {
    width: 45px; height: 45px;
    left: 200px; top: 30%;
    animation: floatSphere3 10s ease-in-out infinite;
}
.sp-cats-sphere-wrap.sphere-3 .sphere-inner {
    background: radial-gradient(circle at 35% 35%, #ffffff 0%, #fdf2f8 20%, #fbcfe8 60%, #f472b6 100%);
    box-shadow:
        inset -5px -8px 10px rgba(236, 72, 153, 0.3),
        inset 5px 5px 8px rgba(255, 255, 255, 0.9),
        2px 5px 10px rgba(0,0,0,0.05);
}

@keyframes floatSphere1 {
    0%, 100% { transform: translateY(0) translateX(0) rotate(0deg); }
    50% { transform: translateY(-35px) translateX(20px) rotate(8deg); }
}
@keyframes floatSphere2 {
    0%, 100% { transform: translateY(0) translateX(0) rotate(0deg) scale(1); }
    50% { transform: translateY(25px) translateX(15px) rotate(-10deg) scale(1.05); }
}
@keyframes floatSphere3 {
    0%, 100% { transform: translateY(0) translateX(0) rotate(0deg) scale(1); }
    50% { transform: translateY(-15px) translateX(-15px) rotate(15deg) scale(0.9); }
}
@keyframes glowPulse {
    0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.9; transform: translate(-50%, -50%) scale(1.15); }
}
@keyframes shadowScale {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 0.2; transform: scale(1.2); }
}

/* ── Wavy nets ── */
.sp-cats-waves {
    position: absolute;
    right: -10%;
    top: 0;
    width: 70%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: visible;
}
.sp-cats-wave-svg {
    width: 100%;
    height: 120%;
    object-fit: cover;
}

.wave-layer-1 {
    transform-origin: center right;
}

.wave-layer-2 {
    transform-origin: bottom right;
}

@keyframes waveDrift {
    0%   { transform: translate(0, 0) scale(1) rotate(0deg); }
    25%  { transform: translate(18px, -14px) scale(1.04) rotate(1.5deg); }
    50%  { transform: translate(-8px, 12px) scale(0.97) rotate(-1.8deg); }
    75%  { transform: translate(12px, -8px) scale(1.02) rotate(0.8deg); }
    100% { transform: translate(0, 0) scale(1) rotate(0deg); }
}

@keyframes waveTendril {
    0%   { transform: translate(0, 0) scale(1) rotate(0deg) skewX(0deg); }
    33%  { transform: translate(-20px, 18px) scale(1.06) rotate(-2.5deg) skewX(1.5deg); }
    66%  { transform: translate(15px, -12px) scale(0.94) rotate(2deg) skewX(-1deg); }
    100% { transform: translate(0, 0) scale(1) rotate(0deg) skewX(0deg); }
}

.wave-path {
    animation: waveDrift var(--w-dur, 20s) cubic-bezier(0.39, 0.58, 0.57, 1) var(--w-delay, 0s) infinite;
}

.wave-layer-2 .wave-path {
    animation-name: waveTendril;
    animation-timing-function: cubic-bezier(0.6, 0.04, 0.98, 0.34);
}

/* ── Header ── */
.sp-cats-header {
    text-align: center;
    position: relative;
    z-index: 2;
    margin-bottom: 2.5rem;
}

.sp-cats-title {
    font-size: clamp(2.2rem, 4vw, 3.5rem);
    font-weight: 800;
    color: #1e293b;
    margin: 0 0 1rem;
    letter-spacing: -0.03em;
}

.sp-cats-title .text-gradient {
    color: #2563eb;
}

.sp-cats-subtitle {
    font-size: 1.1rem;
    color: #334155;
    line-height: 1.6;
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    margin: 0;
    font-weight: 400;
}

/* ── Flip Grid ── */
.sp-cats-grid {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.sp-cats-grid::before {
    content: '';
    position: absolute;
    inset: -40px -20px;
    background: radial-gradient(ellipse at 50% 50%, rgba(139, 92, 246, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

.sp-cats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    justify-content: center;
    max-height: 76px;
    overflow: hidden;
}

.sp-cats-row.bottom-row {
    margin-left: 3rem;
}

/* ── Flip Pill ── */
.sp-cat-pill {
    perspective: 800px;
    text-decoration: none;
    display: inline-flex;
}

.sp-cat-pill-inner {
    position: relative;
    width: 100%;
    min-width: 150px;
    height: auto;
    min-height: 64px;
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    transform-style: preserve-3d;
}

.sp-cat-pill.is-flipped .sp-cat-pill-inner {
    transform: rotateY(180deg);
}

/* ── Hover premium sans flip ── */
.sp-cat-pill {
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.sp-cat-pill:hover {
    transform: translateY(-3px);
}

.sp-cat-pill-front,
.sp-cat-pill-back {
    transition:
        border-color 0.4s ease,
        background 0.4s ease,
        box-shadow 0.4s ease;
}

/* Face avant (blanche) : subrillance bleue + trait de coupe en haut */
.sp-cat-pill:not(.is-flipped):hover .sp-cat-pill-front {
    border-color: #2563eb;
    background: linear-gradient(135deg, #ffffff, #eff6ff);
    box-shadow:
        inset 0 1px 2px rgba(255,255,255,0.9),
        inset 0 -1px 3px rgba(37,99,235,0.06),
        0 0 0 1px rgba(37, 99, 235, 0.08),
        0 8px 28px rgba(37, 99, 235, 0.14),
        0 0 60px rgba(37, 99, 235, 0.06);
}

.sp-cat-pill-front::after {
    content: '';
    position: absolute;
    top: 0;
    left: 12px;
    right: 12px;
    height: 3px;
    background: #2563eb;
    border-radius: 0 0 4px 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sp-cat-pill:not(.is-flipped):hover .sp-cat-pill-front::after {
    opacity: 1;
}

/* Face arrière (bleutée) : opposé du bleu = ambré + trait de coupe */
.sp-cat-pill.is-flipped:hover .sp-cat-pill-back {
    border-color: #ef4444;
    background: linear-gradient(135deg, #fca5a5, #f87171, #ef4444);
    box-shadow:
        0 0 0 1px rgba(234, 88, 12, 0.08),
        0 0 24px rgba(234, 88, 12, 0.10),
        0 0 50px rgba(234, 88, 12, 0.04);
}

.sp-cat-pill-back::after {
    content: '';
    position: absolute;
    top: 0;
    left: 12px;
    right: 12px;
    height: 3px;
    background: #ef4444;
    border-radius: 0 0 4px 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sp-cat-pill.is-flipped:hover .sp-cat-pill-back::after {
    opacity: 1;
}

.sp-cat-pill-front,
.sp-cat-pill-back {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 40px;
    backface-visibility: hidden;
    padding: 0.6rem 1.4rem;
    overflow: hidden;
}

.sp-cat-pill-front {
    background: linear-gradient(180deg, #ffffff 0%, #faf9ff 100%);
    border: 1px solid #cbd5e1;
    box-shadow:
        inset 0 1px 2px rgba(255,255,255,0.8),
        inset 0 -1px 3px rgba(99,102,241,0.04),
        0 4px 12px rgba(0,0,0,0.05);
}

.sp-cat-pill-back {
    background: linear-gradient(135deg, #f0eaff, #eef2ff, #ede9fe);
    border: 1px solid #a78bfa;
    transform: rotateY(180deg);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.10);
}

.sp-cat-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.35;
    text-align: center;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sp-cat-name-back {
    font-size: 0.82rem;
    font-weight: 800;
    color: #6366f1;
    text-align: center;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sp-cat-dot {
    position: absolute;
    left: 1.4rem;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #8b5cf6;
}

/* ── Footer CTA ── */
.sp-cats-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2.5rem;
    position: relative;
    z-index: 2;
}

.sp-cats-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%);
    color: #ffffff;
    padding: 10px 10px 10px 28px;
    border-radius: 40px;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.35);
    transition: all 0.3s ease;
    font-family: 'Outfit', sans-serif;
    animation: btnBreathe 2s cubic-bezier(0.34, 1.56, 0.64, 1) infinite;
    position: relative;
    overflow: hidden;
}

.sp-cats-btn-primary::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 50%, rgba(255,255,255,0.12), transparent 60%);
    pointer-events: none;
    animation: btnShine 3s ease-in-out infinite;
}

@keyframes btnShine {
    0% { opacity: 0; transform: scale(0.5); }
    30% { opacity: 1; }
    60% { opacity: 0; transform: scale(1.5); }
    100% { opacity: 0; }
}

.sp-cats-btn-primary:hover {
    transform: translateY(-5px) scale(1.08);
    background: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
    box-shadow: 0 25px 60px rgba(99, 102, 241, 0.6), 0 0 60px rgba(124, 58, 237, 0.35);
    color: #ffffff;
    animation-play-state: paused;
}

.sp-cats-btn-primary:hover .btn-icon {
    transform: scale(1.15) rotate(-8deg);
}

.sp-cats-btn-primary:hover .btn-icon i {
    animation: btnArrowHover 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) infinite;
}

@keyframes btnArrowHover {
    0%   { transform: translateX(0) rotate(0deg); }
    30%  { transform: translateX(8px) rotate(8deg); }
    60%  { transform: translateX(-2px) rotate(-4deg); }
    100% { transform: translateX(8px) rotate(0deg); }
}

.sp-cats-btn-primary .btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #ffffff;
    color: #6366f1;
    border-radius: 50%;
    font-size: 1rem;
    transition: transform 0.3s ease;
}

.sp-cats-btn-primary .btn-icon i {
    animation: btnArrowSlide 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) infinite;
}

@keyframes btnArrowSlide {
    0%   { transform: translateX(-3px) scale(1); opacity: 0.6; }
    40%  { transform: translateX(8px) scale(1.2); opacity: 1; }
    60%  { transform: translateX(8px) scale(1.2); opacity: 1; }
    100% { transform: translateX(-3px) scale(1); opacity: 0.6; }
}

@keyframes btnBreathe {
    0%   { transform: translateY(0) scale(1); box-shadow: 0 10px 30px rgba(99, 102, 241, 0.35); }
    30%  { transform: translateY(-5px) scale(1.04); box-shadow: 0 20px 50px rgba(99, 102, 241, 0.55), 0 0 40px rgba(124, 58, 237, 0.2); }
    50%  { transform: translateY(-3px) scale(1.02); box-shadow: 0 15px 40px rgba(99, 102, 241, 0.45); }
    80%  { transform: translateY(-6px) scale(1.05); box-shadow: 0 22px 55px rgba(99, 102, 241, 0.6), 0 0 50px rgba(124, 58, 237, 0.25); }
    100% { transform: translateY(0) scale(1); box-shadow: 0 10px 30px rgba(99, 102, 241, 0.35); }
}

/* ── Responsive ── */
@media (max-width: 992px) {
    .sp-cats-row { justify-content: center; }
    .sp-cats-row.bottom-row { margin-left: 0; }
    .sp-cats-footer { flex-direction: column; gap: 1.5rem; }
}

@media (max-width: 768px) {
    .sp-categories-section { padding: 2.5rem 0 2rem; }
    .sp-cats-subtitle br { display: none; }
}

@media (max-width: 480px) {
    .sp-categories-section { padding: 1.5rem 0 1rem; }
    .sp-cats-header { padding: 0 12px; }
    .sp-cats-title { font-size: 1.4rem; }
    .sp-cats-subtitle { font-size: 0.85rem; }
    .sp-cats-row { gap: 6px; }
    .sp-cats-footer { padding: 1rem 12px; }
    .sp-cats-cta { width: 100%; justify-content: center; font-size: 0.85rem; padding: 10px 16px; text-align: center; }
}
