/* AI Edge / Features Section - Bento Grid */
.features-section {
    position: relative;
    padding: 100px 8%;
    z-index: 10;
}

.features-header {
    text-align: center;
    margin-bottom: 60px;
}

.features-title {
    font-family: var(--font-heading, sans-serif);
    font-size: clamp(2rem, 4vw, 3.5rem);
    color: #fff;
    margin-bottom: 20px;
}

.features-subtitle {
    color: rgba(255, 255, 255, 0.7);
    max-width: 700px;
    margin: 0 auto;
    font-size: 1.1rem;
    line-height: 1.6;
}

/* Bento Grid Layout */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 280px);
    /* Expanded to 3 rows */
    /* Fixed height rows for consistency */
    gap: 24px;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    grid-auto-flow: dense;
    /* Fills gaps */
}

/* Grid Item Base */
.bento-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 30px;
    position: relative;
    overflow: hidden;
    transition: transform 0.1s ease, box-shadow 0.4s ease;
    /* Faster transform for tilt */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 1;
}

/* Spotlight Effect */
.bento-item::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 24px;
    padding: 2px;
    /* Border width */
    background: radial-gradient(800px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
            rgba(255, 255, 255, 0.4),
            transparent 40%);
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    /* Standard property */
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    z-index: 2;
}

/* Staggered Scroll Animations for Bento Grid */
.bento-grid .bento-item:nth-child(1) {
    transition-delay: 0.1s;
}

.bento-grid .bento-item:nth-child(2) {
    transition-delay: 0.2s;
}

.bento-grid .bento-item:nth-child(3) {
    transition-delay: 0.3s;
}

.bento-grid .bento-item:nth-child(4) {
    transition-delay: 0.4s;
}

.bento-grid .bento-item:nth-child(5) {
    transition-delay: 0.15s;
}

/* Row 2 starts */
.bento-grid .bento-item:nth-child(6) {
    transition-delay: 0.25s;
}

.bento-grid .bento-item:nth-child(7) {
    transition-delay: 0.35s;
}

.bento-grid .bento-item:nth-child(8) {
    transition-delay: 0.45s;
}

.bento-grid .bento-item:nth-child(9) {
    transition-delay: 0.55s;
}

/* Torch effect disabled - keeping opacity at 0 */
.bento-grid:hover .bento-item::before {
    opacity: 0;
}

/* 3D Tilt & Lift */
.bento-item:hover {
    transform: translateY(-5px) scale(1.02);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

/* Grid Spans */
.bento-wide {
    grid-column: span 2;
}

.bento-tall {
    grid-row: span 2;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01));
}

.bento-big {
    grid-column: span 2;
    grid-row: span 2;
}

/* Content Styling */
.bento-icon {
    font-size: 2.5rem;
    /* Fallback for emojis */
    margin-bottom: 20px;
    width: fit-content;
}

.bento-icon img {
    width: 60px;
    /* Sized to match 3D aesthetic */
    height: 60px;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 5px 15px rgba(123, 63, 242, 0.2));
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Bouncy spring effect */
}

/* Zero-G Lift Effect on Card Hover */
.bento-item:hover .bento-icon img {
    transform: translateY(-12px) scale(1.15) rotate(3deg);
    filter: drop-shadow(0 20px 25px rgba(123, 63, 242, 0.4));
}

.bento-item h3 {
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 12px;
    font-weight: 700;
}

.bento-item p {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
}

/* Visual Decorations */
.bento-decor {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100%;
    height: 150px;
    background: radial-gradient(circle at bottom right, rgba(123, 63, 242, 0.3), transparent 70%);
    pointer-events: none;
    opacity: 0.6;
}

/* Light Mode Overrides */
[data-theme="light"] .features-title {
    color: #111;
}

[data-theme="light"] .features-subtitle {
    color: #555;
}

[data-theme="light"] .bento-item {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .bento-item:hover {
    border-color: rgba(123, 63, 242, 0.4);
    box-shadow: 0 10px 20px rgba(123, 63, 242, 0.1);
}

[data-theme="light"] .bento-item h3 {
    color: #111;
}

[data-theme="light"] .bento-item p {
    color: #666;
}

/* Light Mode Spotlight */
[data-theme="light"] .bento-item::before {
    background: radial-gradient(800px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
            rgba(123, 63, 242, 0.15),
            transparent 40%);
}

[data-theme="light"] .bento-tall {
    background: linear-gradient(145deg, #f8f9fa, #ffffff);
}

[data-theme="light"] .bento-item:hover {
    background: #ffffff;
    border-color: rgba(123, 63, 242, 0.4);
    box-shadow: 0 15px 30px rgba(123, 63, 242, 0.1);
}

/* Gradient Variations (Using User's Specific Radial Settings) */
.bento-blue {
    background: radial-gradient(circle farthest-corner at 32.7% 49.8%, rgba(28, 88, 238, 0.15) 0%, rgba(0, 39, 137, 0.05) 100.2%) !important;
    border-color: rgba(28, 88, 238, 0.3);
}

.bento-purple {
    background: radial-gradient(circle farthest-corner at 32.7% 49.8%, rgba(123, 63, 242, 0.15) 0%, rgba(45, 10, 115, 0.05) 100.2%) !important;
    border-color: rgba(123, 63, 242, 0.3);
}

.bento-crimson {
    background: radial-gradient(circle farthest-corner at 32.7% 49.8%, rgba(233, 86, 94, 0.15) 0%, rgba(100, 20, 30, 0.05) 100.2%) !important;
    border-color: rgba(233, 86, 94, 0.3);
}

.bento-teal {
    background: radial-gradient(circle farthest-corner at 32.7% 49.8%, rgba(6, 182, 212, 0.15) 0%, rgba(8, 51, 68, 0.05) 100.2%) !important;
    border-color: rgba(6, 182, 212, 0.3);
}

.bento-item:hover.bento-blue {
    background: radial-gradient(circle farthest-corner at 32.7% 49.8%, rgba(28, 88, 238, 0.3) 0%, rgba(0, 39, 137, 0.1) 100.2%) !important;
}

.bento-item:hover.bento-purple {
    background: radial-gradient(circle farthest-corner at 32.7% 49.8%, rgba(123, 63, 242, 0.3) 0%, rgba(45, 10, 115, 0.1) 100.2%) !important;
}

.bento-item:hover.bento-crimson {
    background: radial-gradient(circle farthest-corner at 32.7% 49.8%, rgba(233, 86, 94, 0.3) 0%, rgba(100, 20, 30, 0.1) 100.2%) !important;
}

.bento-item:hover.bento-teal {
    background: radial-gradient(circle farthest-corner at 32.7% 49.8%, rgba(6, 182, 212, 0.3) 0%, rgba(8, 51, 68, 0.1) 100.2%) !important;
}

/* Light Mode Gradients */
[data-theme="light"] .bento-blue {
    background: radial-gradient(circle farthest-corner at 32.7% 49.8%, rgba(28, 88, 238, 0.05) 0%, white 100.2%) !important;
}

[data-theme="light"] .bento-purple {
    background: radial-gradient(circle farthest-corner at 32.7% 49.8%, rgba(123, 63, 242, 0.05) 0%, white 100.2%) !important;
}

[data-theme="light"] .bento-crimson {
    background: radial-gradient(circle farthest-corner at 32.7% 49.8%, rgba(233, 86, 94, 0.05) 0%, white 100.2%) !important;
}

[data-theme="light"] .bento-teal {
    background: radial-gradient(circle farthest-corner at 32.7% 49.8%, rgba(6, 182, 212, 0.05) 0%, white 100.2%) !important;
}

/* Mobile Responsiveness */
@media (max-width: 991px) {
    .bento-grid {
        grid-template-columns: 1fr;
        /* Stack vertically */
        grid-template-rows: auto;
    }

    .bento-wide,
    .bento-tall {
        grid-column: span 1;
        grid-row: span 1;
    }

    .bento-item {
        min-height: 200px;
    }
}