/* Basic styling for the safety section */
.safety-section {
    padding: 1rem 0 1rem 0 !important;
    margin-top: 4rem;
    position: relative;
    background-color: #ffffff;
}

.safety-content-wrapper {
    display: flex;
    align-items: center;
    gap: 6rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

.safety-image {
    flex: 1.85;
    max-width: 65%;
}

.safety-feature-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.safety-feature-image:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.safety-content {
    flex: 1;
    max-width: 35%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.safety-content h2 {
    font-size: 2.5rem;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    color: #202124;
    text-align: center;
}

.safety-content .section-description {
    font-size: 1.5rem;
    line-height: 1.7;
    color: #5f6368;
    margin-bottom: 2rem;
    text-align: center;
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
}

.learn-more-btn {
    display: inline-block;
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-weight: 500;
    color: #1a73e8;
    background-color: transparent;
    border: 2px solid #1a73e8;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.learn-more-btn:hover {
    background-color: #1a73e8;
    color: #ffffff;
    transform: translateY(-2px);
}

@media (max-width: 1024px) {
    .safety-content-wrapper {
        gap: 3rem;
    }

    .safety-content h2 {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .safety-section {
        padding: 0.5rem 0 0.5rem 0 !important;
    }

    .safety-content-wrapper {
        flex-direction: column;
        gap: 2rem;
    }

    .safety-image,
    .safety-content {
        max-width: 100%;
    }

    .safety-content h2 {
        font-size: 1.75rem;
    }

    .safety-content .section-description {
        font-size: 1.25rem;
    }
}

/* Override section-divider background */
.section-divider.safety-section {
    background-color: #ffffff !important;
    padding-top: 0 !important; /* Remove top padding */
    padding-bottom: var(--spacing-md) !important;
    border-bottom: none !important;
    position: relative;
}

/* Remove the custom divider line */
/* .section-divider.safety-section::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: var(--color-border);
} */

.safety-animation-container {
    position: relative;
    width: 100%;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: transform 0.3s ease;
    padding: 3rem 2rem 3rem 2rem; /* Increased top padding from 2.5rem to 3rem */
    background-color: #ffffff;
    perspective: 1500px;
}

.safety-animation-container:hover {
    transform: scale(1.01);
}

.safety-background-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    transition: transform 0.5s ease; /* Smooth transition for 3D effect */
    transform-origin: center center; /* Ensure rotation happens from the center */
}

.safety-animation-container:hover .safety-background-svg {
    transform: rotateX(0.5deg); /* Very subtle rotation only on X axis */
}

.safety-section .section-content {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    text-align: center;
    position: relative;
    z-index: 2; /* Ensure content is above the overlay */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.safety-section h2 {
    margin-bottom: 1.5rem;
    color: var(--color-text);
    font-size: 2.25rem !important;
    position: relative;
}

.safety-section h2::after {
    display: none; /* Remove the underline */
}

.safety-section .section-description {
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
    color: var(--color-text-secondary);
    font-size: 1.5rem;
}

/* Sandbox Border Animation */
.sandbox-border {
    stroke-dasharray: 3200;
    stroke-dashoffset: 3200;
    filter: drop-shadow(0 0 10px rgba(66, 133, 244, 0.3));
    transition: all 0.3s ease;
    opacity: 0; /* Hide border initially */
    transform-origin: center center;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.safety-animation-container:hover .sandbox-border {
    animation: draw-border 3s ease forwards;
    opacity: 1;
    filter: drop-shadow(0 0 18px rgba(66, 133, 244, 0.5)); /* Enhanced shadow */
}

.sandbox-border.highlight {
    stroke-width: 5;
    filter: drop-shadow(0 0 25px rgba(26, 115, 232, 0.7));
    transition: all 0.3s ease;
}

.sandbox-border.pulse {
    animation: border-pulse 1s ease-out;
}

@keyframes draw-border {
    from {
        stroke-dashoffset: 3200;
    }
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes border-pulse {
    0% {
        stroke-width: 4;
        filter: drop-shadow(0 0 5px rgba(66, 133, 244, 0.3));
    }
    50% {
        stroke-width: 7;
        filter: drop-shadow(0 0 20px rgba(26, 115, 232, 0.8));
    }
    100% {
        stroke-width: 4;
        filter: drop-shadow(0 0 5px rgba(66, 133, 244, 0.3));
    }
}

/* Sandbox Fill and Depth Effects */
.sandbox-fill {
    opacity: 1;
    transition: all 0.3s ease;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.05)); /* Add subtle shadow */
    fill: url(#subtle-pattern); /* Explicitly set initial fill */
}

/* Sand overlay for color transition */
.sandbox-sand-overlay {
    transition: all 0.3s ease;
    opacity: 1;
    fill: rgba(249, 236, 213, 0); /* Completely transparent initially */
}

.safety-animation-container:hover .sandbox-sand-overlay {
    animation: sand-color-fade 3s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

/* Remove the pseudo-element overlay */
.safety-animation-container::after {
    display: none;
}

.safety-animation-container:hover .sandbox-fill {
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.08)); /* Enhanced shadow on hover */
}

@keyframes sand-color-fade {
    0% {
        fill: rgba(249, 236, 213, 0);
    }
    25% {
        fill: rgba(249, 236, 213, 0.15);
    }
    50% {
        fill: rgba(249, 236, 213, 0.3);
    }
    75% {
        fill: rgba(249, 236, 213, 0.45);
    }
    100% {
        fill: rgba(249, 236, 213, 0.6);
    }
}

/* Inner shadow effect */
.sandbox-inner-shadow {
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.safety-animation-container:hover .sandbox-inner-shadow {
    opacity: 0.8;
}

/* Background layer for depth */
.sandbox-background-layer {
    opacity: 0.3;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateZ(-1px); /* Reduced 3D position for less distortion */
}

.safety-animation-container:hover .sandbox-background-layer {
    opacity: 0.5;
    transform: translateZ(-2px); /* Reduced 3D effect for better symmetry */
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Respect user preferences for reduced motion */
@media (prefers-reduced-motion: reduce) {
    .safety-animation-container:hover .sandbox-border {
        animation: none;
        stroke-dashoffset: 0;
        opacity: 1;
    }
    
    .safety-animation-container:hover {
        transform: none;
    }
    
    .safety-animation-container:hover .safety-background-svg {
        transform: none;
    }
}

.safety-section .learn-more {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--color-primary);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.safety-section .learn-more:hover {
    background-color: var(--color-primary-dark);
}

/* Media queries for responsive design */
@media (max-width: 768px) {
    .safety-section h2 {
        font-size: 1.75rem !important;
    }
    
    .safety-section .section-description {
        font-size: 1.25rem;
    }
    
    .safety-animation-container {
        min-height: 250px;
        padding: 2rem 1rem;
    }
}

/* Sandbox Shapes Animation */
.sandbox-shape {
    opacity: 0;
    transform-origin: center center;
    transition: opacity 0.5s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.12));
    pointer-events: none; /* Ensure shapes cannot be interacted with */
}

/* Staggered appearance and spinning of shapes */
.safety-animation-container:hover .sandbox-shape.circle {
    opacity: 0.85;
    animation: spin-in-circle 2.5s ease-out forwards, subtle-pulse 6s ease-in-out infinite 2.5s;
    transition-delay: 0.6s; /* Appear after border animation starts */
}

.safety-animation-container:hover .sandbox-shape.square {
    opacity: 0.85;
    animation: spin-in-square 2.5s ease-out forwards, subtle-pulse 6s ease-in-out infinite 2.5s;
    transition-delay: 0.8s;
}

.safety-animation-container:hover .sandbox-shape.triangle {
    opacity: 0.85;
    animation: spin-in-triangle 2.5s ease-out forwards, subtle-pulse 6s ease-in-out infinite 2.5s;
    transition-delay: 1s;
}

/* Spin-in animations */
@keyframes spin-in-circle {
    0% {
        transform: translate(-100px, 100px) rotate(0deg) scale(0.2);
    }
    100% {
        transform: translate(0, 0) rotate(15deg) scale(1);
    }
}

@keyframes spin-in-square {
    0% {
        transform: translate(100px, 100px) rotate(0deg) scale(0.2);
    }
    100% {
        transform: translate(0, 0) rotate(-12deg) scale(1);
    }
}

@keyframes spin-in-triangle {
    0% {
        transform: translate(100px, -100px) rotate(0deg) scale(0.2);
    }
    100% {
        transform: translate(0, 0) rotate(8deg) scale(1);
    }
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .safety-animation-container:hover .sandbox-shape {
        opacity: 0.75;
        animation: none;
        transition: opacity 0.3s ease;
        transition-delay: 0.3s;
    }
}

/* Subtle pulse animation for shapes after they land */
@keyframes subtle-pulse {
    0% {
        filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.12));
        transform: scale(1) rotate(var(--final-rotation));
    }
    50% {
        filter: drop-shadow(0 3px 6px rgba(66, 133, 244, 0.25));
        transform: scale(1.03) rotate(var(--final-rotation));
    }
    100% {
        filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.12));
        transform: scale(1) rotate(var(--final-rotation));
    }
}

/* Set final rotation values for each shape */
.safety-animation-container:hover .sandbox-shape.circle {
    --final-rotation: 15deg;
}

.safety-animation-container:hover .sandbox-shape.square {
    --final-rotation: -12deg;
}

.safety-animation-container:hover .sandbox-shape.triangle {
    --final-rotation: 8deg;
} 