/* =========================================
   FEATURES SECTION — 3D tilt, animated icon rings, scroll slide-in.
   Derived from: PetCard depth, GlassContainer glow shadows,
   PetActivityTheme accent colors.
   ========================================= */

section#features {
    padding-block: clamp(5rem, 10vh, 9rem);
    background: var(--clr-bg-light);
    overflow: hidden;
    position: relative;
}

section#features::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, var(--clr-accent-teal) 0%, transparent 60%);
    opacity: 0.06;
    pointer-events: none;
    z-index: 0;
}

section#features>.container {
    position: relative;
    z-index: 1;
}

.features-header {
    text-align: center;
    margin-bottom: clamp(3rem, 6vh, 5rem);
}

.features-header h2 {
    font-size: clamp(2rem, 4vw, 3.2rem);
    font-weight: 700;
}

/* ── Feature Row — Scroll-driven slide-in ────────────────────────── */

.feature-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(2rem, 5vw, 5rem);
    align-items: center;
    margin-bottom: clamp(4rem, 8vh, 7rem);
}

.feature-row--reverse {
    direction: rtl;
}

.feature-row--reverse>* {
    direction: ltr;
}

/* Scroll-driven slide animations for feature rows */
@supports (animation-timeline: view()) {
    .feature-row .feature-text {
        animation: scrollSlideLeft 1s linear both;
        animation-timeline: view();
        animation-range: entry 0% cover 30%;
    }

    .feature-row .feature-visual {
        animation: scrollSlideRight 1s linear both;
        animation-timeline: view();
        animation-range: entry 0% cover 30%;
    }

    .feature-row--reverse .feature-text {
        animation-name: scrollSlideRight;
    }

    .feature-row--reverse .feature-visual {
        animation-name: scrollSlideLeft;
    }
}

.feature-text h3 {
    font-size: clamp(1.6rem, 2.5vw, 2.4rem);
    font-weight: 700;
    margin-bottom: 1rem;
}

.feature-text p {
    font-size: 1.05rem;
    opacity: 0.72;
    line-height: 1.7;
    max-width: 44ch;
}

.badge-coming-soon {
    border-radius: var(--radius-pill);
    background: rgba(251, 191, 36, 0.15);
    color: var(--clr-accent-amber);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.3rem 0.9rem;
    display: inline-block;
    margin-top: 1rem;
}

/* ── Feature Card — 3D Tilt + Enhanced Glow ──────────────────────── */

.feature-card {
    padding: 2.5rem;
    border-radius: var(--radius-card);
    transition:
        transform 0.4s var(--ease-smooth),
        box-shadow 0.4s var(--ease-smooth);
    display: flex;
    flex-direction: column;
    gap: 10px;
    will-change: transform;
    transform-style: preserve-3d;
}

/* 3D tilt — JS sets --rx, --ry for perspective rotation */
.feature-card.is-tilting {
    transform: perspective(800px) rotateX(calc(var(--ry, 0) * 1deg)) rotateY(calc(var(--rx, 0) * 1deg));
}

.feature-card.accent-teal { border-color: rgba(45, 212, 191, 0.35); }
.feature-card.accent-pink { border-color: rgba(244, 114, 182, 0.35); }
.feature-card.accent-purple { border-color: rgba(167, 139, 250, 0.35); }
.feature-card.accent-amber { border-color: rgba(251, 191, 36, 0.35); }

/* ── Animated Icon Ring ──────────────────────────────────────────── */

.feature-icon-wrap {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

/* Rotating gradient ring behind icon */
.feature-icon-wrap::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 22px;
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: -1;
    animation: iconRingSpin 8s linear infinite;
    pointer-events: none;
}

.feature-card:hover .feature-icon-wrap::before {
    opacity: 1;
}

/* Accent-specific icon ring gradients */
.feature-card.accent-teal .feature-icon-wrap {
    background: rgba(45, 212, 191, 0.15);
    box-shadow: 0 0 20px rgba(45, 212, 191, 0.3);
}

.feature-card.accent-teal .feature-icon-wrap::before {
    background: conic-gradient(
        rgba(45, 212, 191, 0.4),
        rgba(45, 212, 191, 0.05),
        rgba(45, 212, 191, 0.4)
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    padding: 2px;
}

.feature-card.accent-pink .feature-icon-wrap {
    background: rgba(244, 114, 182, 0.15);
    box-shadow: 0 0 20px rgba(244, 114, 182, 0.3);
}

.feature-card.accent-pink .feature-icon-wrap::before {
    background: conic-gradient(
        rgba(244, 114, 182, 0.4),
        rgba(244, 114, 182, 0.05),
        rgba(244, 114, 182, 0.4)
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    padding: 2px;
}

.feature-card.accent-purple .feature-icon-wrap {
    background: rgba(167, 139, 250, 0.15);
    box-shadow: 0 0 20px rgba(167, 139, 250, 0.3);
}

.feature-card.accent-purple .feature-icon-wrap::before {
    background: conic-gradient(
        rgba(167, 139, 250, 0.4),
        rgba(167, 139, 250, 0.05),
        rgba(167, 139, 250, 0.4)
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    padding: 2px;
}

.feature-card.accent-amber .feature-icon-wrap {
    background: rgba(251, 191, 36, 0.15);
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.3);
}

.feature-card.accent-amber .feature-icon-wrap::before {
    background: conic-gradient(
        rgba(251, 191, 36, 0.4),
        rgba(251, 191, 36, 0.05),
        rgba(251, 191, 36, 0.4)
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    padding: 2px;
}

/* ── Feature Skeleton Lines ──────────────────────────────────────── */

.feat-skel-line {
    height: 8px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.07);
    position: relative;
    overflow: hidden;
}

.feat-skel-line::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(244, 123, 37, 0.06) 50%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: shimmer 3s ease-in-out infinite;
}

/* ── Card Hover States ───────────────────────────────────────────── */

.feature-card:hover {
    transform: translateY(-6px);
}

.feature-card.accent-teal:hover {
    box-shadow: 0 14px 40px rgba(45, 212, 191, 0.25), 0 0 0 1px rgba(45, 212, 191, 0.15);
}

.feature-card.accent-pink:hover {
    box-shadow: 0 14px 40px rgba(244, 114, 182, 0.25), 0 0 0 1px rgba(244, 114, 182, 0.15);
}

.feature-card.accent-purple:hover {
    box-shadow: 0 14px 40px rgba(167, 139, 250, 0.25), 0 0 0 1px rgba(167, 139, 250, 0.15);
}

.feature-card.accent-amber:hover {
    box-shadow: 0 14px 40px rgba(251, 191, 36, 0.25), 0 0 0 1px rgba(251, 191, 36, 0.15);
}

/* ── Mobile ──────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .feature-row,
    .feature-row--reverse {
        grid-template-columns: 1fr;
        direction: ltr;
    }

    .features-header,
    .feature-text {
        text-align: center;
    }

    .feature-text p {
        margin-inline: auto;
    }
}

/* =========================================
   PLUS GRID — 6 compact cards with stagger
   ========================================= */

.plus-grid-header {
    text-align: center;
    margin-top: clamp(3rem, 6vh, 5rem);
    margin-bottom: clamp(2rem, 4vh, 3rem);
}

.plus-grid-header h2 {
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    font-weight: 700;
    opacity: 0.92;
}

.plus-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(1rem, 2vw, 1.75rem);
    margin-top: 1rem;
}

.plus-card {
    padding: 1.75rem 1.5rem;
    border-radius: var(--radius-card);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition:
        transform 0.4s var(--ease-smooth),
        box-shadow 0.4s var(--ease-smooth),
        border-color 0.3s ease;
    will-change: transform;
    transform-style: preserve-3d;
}

/* 3D tilt support for plus cards */
.plus-card.is-tilting {
    transform: perspective(800px) rotateX(calc(var(--ry, 0) * 1deg)) rotateY(calc(var(--rx, 0) * 1deg));
}

.plus-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.08);
    border-color: rgba(244, 123, 37, 0.15);
}

.plus-icon {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(244, 123, 37, 0.1);
    display: grid;
    place-items: center;
    transition: transform 0.3s var(--ease-bounce), box-shadow 0.3s ease;
}

.plus-card:hover .plus-icon {
    transform: scale(1.1) rotate(-3deg);
    box-shadow: 0 0 16px rgba(244, 123, 37, 0.2);
}

.plus-card h4 {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
}

.plus-card p {
    font-size: 0.92rem;
    opacity: 0.7;
    line-height: 1.55;
    margin: 0;
}

@media (max-width: 900px) {
    .plus-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 560px) {
    .plus-grid {
        grid-template-columns: 1fr;
    }
}