/* Modern Tech Headshot Styles - Redesigned */
.headshot-frame {
    max-width: 90vw;
    width: 75%;
    margin: 0 auto;
    overflow: visible;
    box-sizing: border-box;
    padding: 0;
    position: relative;
    z-index: 1; /* Lower z-index to ensure it doesn't overlap header */
    perspective: 1000px;
    transform: perspective(1000px) translateZ(0);
    transition: all 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
    will-change: transform;
    transform-origin: center center;
}

.headshot-frame:hover {
    transform: perspective(1000px) translateZ(10px);
}

/* Circular container with hexagon clip mask */
.headshot-container {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    overflow: hidden;
    box-sizing: border-box;
    padding: 0;
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.8), rgba(30, 41, 59, 0.7));
    border-radius: 50%;
    position: relative;
    aspect-ratio: 1/1; /* Force a perfect circle */
}

.headshot-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #1f2937 0%, #374151 50%, #1f2937 100%);
    background-size: 200% 100%;
    animation: placeholderShimmer 1.5s infinite;
    border-radius: 50%;
    z-index: -1;
}

/* Image styling */
.headshot-container img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    object-fit: cover !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
    outline: none !important;
    border-radius: 50% !important;
    object-position: center top !important;
    transition: filter 0.5s ease, opacity 0.5s ease !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Blur-up effect */
.headshot-container img.blur-up {
    filter: blur(5px);
    transition: filter 0.5s ease-in-out, opacity 0.5s ease-in-out;
}

.headshot-container img.blur-up.loaded {
    filter: blur(0);
    opacity: 1;
}

/* Image wrapper to ensure proper centering */
.image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 50%;
    aspect-ratio: 1/1; /* Force a perfect circle */
}

/* Direct styling for the headshot image */
.headshot-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    transition: all 0.3s ease-out;
    transform: translateZ(0); /* Force GPU acceleration */
}

/* Inner glow effect */
.headshot-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow: inset 0 0 20px rgba(16, 185, 129, 0.3);
    pointer-events: none;
    z-index: 20;
}

/* Light effect created by a pseudo-element */
.headshot-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(
        circle at var(--x, 50%) var(--y, 50%),
        rgba(255, 255, 255, 0.2) 0%,
        rgba(255, 255, 255, 0.1) 20%,
        rgba(255, 255, 255, 0) 60%
    );
    transform: translateZ(0);
    pointer-events: none;
    z-index: 10;
}

/* Tech accent ring */
.tech-corner {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    opacity: 0.8;
    z-index: 4;
}

.tech-corner-tl {
    top: 10%;
    left: 10%;
    border-top: 2px solid rgba(6, 182, 212, 0.7);
    border-left: 2px solid rgba(6, 182, 212, 0.7);
    border-radius: 5px 0 0 0;
}

.tech-corner-tr {
    top: 10%;
    right: 10%;
    border-top: 2px solid rgba(37, 99, 235, 0.7);
    border-right: 2px solid rgba(37, 99, 235, 0.7);
    border-radius: 0 5px 0 0;
}

.tech-corner-bl {
    bottom: 10%;
    left: 10%;
    border-bottom: 2px solid rgba(37, 99, 235, 0.7);
    border-left: 2px solid rgba(37, 99, 235, 0.7);
    border-radius: 0 0 0 5px;
}

.tech-corner-br {
    bottom: 10%;
    right: 10%;
    border-bottom: 2px solid rgba(6, 182, 212, 0.7);
    border-right: 2px solid rgba(6, 182, 212, 0.7);
    border-radius: 0 0 5px 0;
}

/* Pulse effect on corners */
.tech-corner {
    animation: pulse-corner 3s infinite alternate;
}

.tech-corner-tl { animation-delay: 0s; }
.tech-corner-tr { animation-delay: 0.75s; }
.tech-corner-bl { animation-delay: 1.5s; }
.tech-corner-br { animation-delay: 2.25s; }

/* Tech data points */
.data-point {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(6, 182, 212, 0.8);
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(6, 182, 212, 0.5);
    z-index: 3;
    opacity: 0;
    animation: data-point-pulse 3s infinite;
}

.data-point:nth-child(1) { top: 25%; left: 5%; animation-delay: 0s; }
.data-point:nth-child(2) { top: 10%; right: 20%; animation-delay: 0.5s; }
.data-point:nth-child(3) { bottom: 15%; left: 15%; animation-delay: 1s; }
.data-point:nth-child(4) { bottom: 20%; right: 8%; animation-delay: 1.5s; }
.data-point:nth-child(5) { top: 40%; right: 5%; animation-delay: 2s; }
.data-point:nth-child(6) { top: 75%; left: 7%; animation-delay: 2.5s; }

/* Outer tech ring */
.tech-ring {
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    border-radius: 50%;
    border: 1px dashed rgba(6, 182, 212, 0.3);
    opacity: 0;
    z-index: 1;
    transition: all 0.5s ease;
}

.headshot-frame:hover .tech-ring {
    opacity: 1;
    transform: scale(1.05) rotate(10deg);
}

/* Scan effect */
.scan-line {
    position: absolute;
    width: 100%;
    height: 2px;
    background: linear-gradient(to right, 
        rgba(6, 182, 212, 0),
        rgba(6, 182, 212, 0.4),
        rgba(37, 99, 235, 0.6),
        rgba(6, 182, 212, 0.4),
        rgba(6, 182, 212, 0));
    top: -10%;
    z-index: 5;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
    opacity: 0.7;
    animation: scan-animation 4s ease-in-out infinite;
}

/* Animations */
@keyframes rotate-ring {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse-corner {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

@keyframes data-point-pulse {
    0% { opacity: 0; transform: scale(0.5); }
    20% { opacity: 1; transform: scale(1); }
    40% { opacity: 0.3; transform: scale(0.8); }
    60% { opacity: 0.8; transform: scale(1.2); }
    80% { opacity: 0.2; transform: scale(0.7); }
    100% { opacity: 0; transform: scale(0.5); }
}

@keyframes scan-animation {
    0% { top: -5%; opacity: 0; }
    20% { opacity: 0.7; }
    80% { opacity: 0.7; }
    100% { top: 105%; opacity: 0; }
}

/* Mobile adjustments for headshot */
@media (max-width: 1280px) {
    .headshot-frame {
        max-width: 80% !important;
        margin: 0 auto !important;
    }
    
    /* Reduce visual complexity on mobile */
    .tech-corner {
        width: 15px;
        height: 15px;
        opacity: 0.6;
    }
    
    .data-point {
        width: 3px;
        height: 3px;
    }
    
    .scan-line {
        height: 1px;
        opacity: 0.5;
    }
    
    /* Better box shadow for mobile */
    .headshot-container {
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2),
                    0 0 0 1px rgba(255, 255, 255, 0.05),
                    0 0 30px rgba(16, 185, 129, 0.15);
    }
    
    /* Ensure animations aren't too resource-intensive */
    .headshot-container::before {
        animation-duration: 12s;
    }
}

@media (max-width: 1024px) {
    .headshot-frame {
        max-width: 70% !important;
    }
}

@media (max-width: 768px) {
    .headshot-frame {
        max-width: 45% !important;
        width: 45% !important;
        margin: 0 auto 1rem auto !important;
    }
    
    .tech-corner {
        width: 15px;
        height: 15px;
        opacity: 0.6;
    }
    
    .data-point {
        width: 3px;
        height: 3px;
    }
    
    .scan-line {
        height: 1px;
        opacity: 0.5;
    }
    
    /* Better box shadow for mobile */
    .headshot-container {
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2),
                    0 0 0 1px rgba(255, 255, 255, 0.05),
                    0 0 30px rgba(16, 185, 129, 0.15);
    }
    
    /* Ensure animations aren't too resource-intensive */
    .headshot-container::before {
        animation-duration: 12s;
    }
}

@media (max-width: 640px) {
    .headshot-frame {
        max-width: 45% !important;
        width: 45% !important;
        margin: 0 auto 0.75rem auto !important;
    }
    
    /* Ensure image is visible */
    .headshot-img {
        opacity: 1 !important;
        visibility: visible !important;
    }
}

@media (max-width: 480px) {
    .headshot-frame {
        max-width: 40% !important;
        width: 40% !important;
        margin: 0 auto 0.5rem auto !important;
    }
    
    .tech-corner {
        width: 12px;
        height: 12px;
        opacity: 0.4;
    }
    
    /* Reduce animation complexity */
    @keyframes rotate-ring {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }
    
    /* Simpler box shadow */
    .headshot-container {
        box-shadow: 0 5px 10px rgba(0, 0, 0, 0.15),
                    0 0 0 1px rgba(255, 255, 255, 0.08),
                    0 0 30px rgba(16, 185, 129, 0.15);
    }
}

/* Short screen fixes */
@media (max-height: 580px) {
    .headshot-frame {
        max-width: 35% !important;
        width: 35% !important;
        margin: 0 auto 0.5rem auto !important;
    }
    
    /* Remove animations on short screens for better performance */
    .tech-corner, .data-point, .scan-line {
        animation: none !important;
        opacity: 0 !important;
    }
}

/* Low power mode with simpler effects */
.headshot-frame.low-power-mode {
    transition: transform 2s ease-in-out;
}

.headshot-frame.low-power-mode .headshot-container::before {
    animation-duration: 20s; /* Much slower rotation */
}

.headshot-frame.low-power-mode .data-point {
    animation: simple-pulse 4s infinite alternate;
}

.headshot-frame.low-power-mode .scan-line {
    animation-duration: 8s; /* Slower scan */
}

@keyframes simple-pulse {
    0% { opacity: 0.2; }
    100% { opacity: 0.7; }
}

/* Mobile performance optimization */
@media (max-width: 768px) {
    /* Use hardware acceleration */
    .headshot-frame,
    .headshot-container,
    .headshot-container::before,
    .headshot-container::after {
        transform: translateZ(0);
        will-change: transform;
    }
    
    /* Reduce animation complexity */
    .headshot-container::before {
        animation-duration: 12s;
    }
    
    .scan-line {
        animation-duration: 6s;
    }
}

/* Desktop adjustments for headshot */
@media (min-width: 1024px) {
    .headshot-frame {
        max-width: 75% !important;
        width: 75% !important;
    }
    
    /* More prominent accent ring */
    .headshot-container::before {
        opacity: 0.8;
        background: conic-gradient(
            transparent 0deg,
            rgba(6, 182, 212, 0.9) 90deg,
            rgba(37, 99, 235, 0.9) 180deg,
            rgba(6, 182, 212, 0.9) 270deg,
            transparent 360deg
        );
    }
    
    /* Stronger overlay pattern */
    .headshot-container::after {
        opacity: 0.7;
        background-size: 150px 150px, 120px 120px;
    }
    
    /* Enhanced scan line */
    .scan-line {
        height: 3px;
        background: linear-gradient(to right, 
            rgba(6, 182, 212, 0.1),
            rgba(6, 182, 212, 0.6),
            rgba(37, 99, 235, 0.8),
            rgba(6, 182, 212, 0.6),
            rgba(6, 182, 212, 0.1)
        );
        box-shadow: 0 0 15px rgba(6, 182, 212, 0.7);
    }
    
    /* Improved shadow */
    .headshot-container {
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4), 
                    0 0 0 1px rgba(6, 182, 212, 0.2), 
                    0 0 0 4px rgba(6, 182, 212, 0.1),
                    inset 0 0 30px rgba(0, 0, 0, 0.5) !important;
    }
    
    /* Enhance visual effects on larger screens */
    .tech-corner {
        width: 25px;
        height: 25px;
    }
    
    .data-point {
        width: 5px;
        height: 5px;
    }
}

@media (min-width: 1280px) {
    .headshot-frame {
        max-width: 80% !important;
        width: 80% !important;
    }
}

@media (min-width: 1536px) {
    .headshot-frame {
        max-width: 80% !important;
        width: 80% !important;
    }
}

/* Special styles for mobile devices */
@media (max-width: 767px) {
    .headshot-container {
        box-shadow: 
            0 5px 15px rgba(0, 0, 0, 0.2),
            0 0 0 1px rgba(255, 255, 255, 0.05),
            0 0 30px rgba(16, 185, 129, 0.15);
    }
    
    .headshot-container::before {
        /* Simpler light effect for mobile */
        background: radial-gradient(
            circle at 50% 40%,
            rgba(255, 255, 255, 0.2) 0%,
            rgba(255, 255, 255, 0.1) 30%,
            rgba(255, 255, 255, 0) 70%
        );
        animation: mobileGlow 5s ease-in-out infinite alternate;
    }
}

/* Animation for mobile glow effect */
@keyframes mobileGlow {
    0% {
        opacity: 0.5;
        transform: rotate(0deg);
    }
    100% {
        opacity: 0.8;
        transform: rotate(360deg);
    }
}

/* Fixes for iOS devices */
@supports (-webkit-touch-callout: none) {
    .headshot-img {
        width: 100% !important;
        height: 100% !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
    
    /* Additional iOS-specific fixes */
    .headshot-container, .image-wrapper {
        height: 0;
        padding-bottom: 100%; /* Creates a square container on iOS */
    }
}

/* Fix for older Android */
@supports not (aspect-ratio: 1/1) {
    .headshot-container, .image-wrapper {
        height: 0;
        padding-bottom: 100%; /* Creates a square container on older browsers */
    }
}

/* Animation for placeholder */
@keyframes placeholderShimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Force image visibility for JS-disabled browsers */
.no-js .headshot-img {
    opacity: 1 !important;
    visibility: visible !important;
    filter: none !important;
}

/* Force image visibility for problematic browsers */
html.force-image-visibility .headshot-img {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Fix for older browsers and mobile Safari */
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
   /* IE10+ CSS */
   .headshot-img {
       opacity: 1 !important;
       visibility: visible !important;
   }
}
