/* Portfolio Custom Styles - Optimized for Performance */

/* Critical path optimizations */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Smooth scrolling with reduced motion respect */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* Custom animations */
@keyframes float {
    0%, 100% { transform: translate3d(0, 0px, 0); }
    50% { transform: translate3d(0, -20px, 0); }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 30px, 0);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Apply animations */
.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

.animate-slide-in-left {
    animation: slideInLeft 0.6s ease-out forwards;
}

.animate-slide-in-right {
    animation: slideInRight 0.6s ease-out forwards;
}

/* Gradient text effect */
.gradient-text {
    background: linear-gradient(135deg, #0ea5e9 0%, #0369a1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Custom button hover effects */
.btn-primary {
    background: linear-gradient(135deg, #0ea5e9 0%, #0369a1 100%);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(14, 165, 233, 0.3);
}

.btn-secondary {
    border: 2px solid #0ea5e9;
    color: #0ea5e9;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #0ea5e9;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(14, 165, 233, 0.2);
}

/* Card hover effects */
.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* Timeline styles */
.timeline-item {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
}

.timeline-item.animate {
    opacity: 1;
    transform: translateY(0);
}

/* Navigation active state */
.nav-link.active {
    color: #0ea5e9 !important;
    font-weight: 600;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #0ea5e9;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #0369a1;
}

/* Form focus states */
input:focus, textarea:focus, select:focus {
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

/* Responsive typography */
@media (max-width: 640px) {
    .hero-title {
        font-size: 2.5rem;
        line-height: 1.2;
    }
}

/* Loading animation for images */
.img-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    h1, h2, h3 {
        page-break-after: avoid;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    /* Add dark mode styles if needed in future */
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .text-gray-600 {
        color: #374151 !important;
    }
    
    .bg-soft-blue-50 {
        background-color: #e0f2fe !important;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* Mobile navigation improvements */
.mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.mobile-menu.active {
    max-height: 300px;
}

/* Section spacing for better visual hierarchy */
section {
    scroll-margin-top: 80px;
}

/* Image placeholder styles */
.image-placeholder {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0369a1;
    font-size: 1.2rem;
}

/* Social media hover effects */
.social-link {
    transition: all 0.3s ease;
}

.social-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(14, 165, 233, 0.3);
}

/* Skills grid improvements */
.skill-item {
    transition: all 0.3s ease;
}

.skill-item:hover {
    background: #0ea5e9;
    color: white;
    transform: scale(1.05);
}

.skill-item:hover i {
    color: white;
}

/* Custom bullet points */
.custom-list {
    list-style: none;
    padding-left: 0;
}

.custom-list li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
}

.custom-list li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: #0ea5e9;
    font-weight: bold;
}

/* Contact form enhancements */
.form-group {
    position: relative;
}

.form-label {
    transition: all 0.3s ease;
}

.form-input:focus + .form-label,
.form-input:not(:placeholder-shown) + .form-label {
    transform: translateY(-1.5rem) scale(0.85);
    color: #0ea5e9;
}

/* Hero section background pattern */
.hero-pattern {
    background-image: radial-gradient(circle at 1px 1px, rgba(14, 165, 233, 0.15) 1px, transparent 0);
    background-size: 20px 20px;
}

/* Service cards grid improvements */
.services-grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* Timeline responsive improvements */
@media (max-width: 768px) {
    .timeline-desktop {
        display: none;
    }
    
    .timeline-mobile {
        display: block;
    }
}

@media (min-width: 769px) {
    .timeline-desktop {
        display: block;
    }
    
    .timeline-mobile {
        display: none;
    }
}

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

/* Focus indicators */
.focus-visible:focus {
    outline: 2px solid #0ea5e9;
    outline-offset: 2px;
}

/* Performance optimizations */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

/* Profile photo specific styles */
.profile-photo-container {
    transform: none !important; /* Prevent parallax effect */
}

/* Responsive photo container */
.profile-photo-container > div:last-child {
    width: 320px;
    height: 400px;
}

@media (max-width: 1024px) {
    .profile-photo-container > div:last-child {
        width: 280px;
        height: 360px;
    }
}

@media (max-width: 768px) {
    .profile-photo-container > div:last-child {
        width: 260px;
        height: 340px;
    }
}

@media (max-width: 480px) {
    .profile-photo-container > div:last-child {
        width: 240px;
        height: 320px;
    }
}

/* Profile photo background image handling */
.profile-photo-container [style*="background-image"] {
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
}

/* Smooth loading animation for background images */
.profile-photo-container > div:last-child {
    transition: all 0.3s ease;
}

.profile-photo-container > div:last-child:hover {
    transform: scale(1.02);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */

/* Image optimization */
img {
    max-width: 100%;
    height: auto;
    font-style: italic;
    background-repeat: no-repeat;
    background-size: cover;
    shape-margin: 0.75rem;
}

/* Lazy loading placeholder */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s;
}

img.loaded {
    opacity: 1;
}

/* Carousel specific optimizations */
.carousel-slide {
    will-change: transform;
    backface-visibility: hidden;
    perspective: 1000px;
    transition: transform 0.5s ease-in-out;
}

.carousel-slide img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Performance-optimized animations */
.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
    will-change: transform, opacity;
}

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

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Modal optimizations */
#imageModal {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: opacity 0.2s ease;
    will-change: opacity;
}

#imageModal .relative {
    transition: transform 0.2s ease;
    will-change: transform;
}

/* Loading states */
.image-loader {
    transition: opacity 0.3s ease;
    background: linear-gradient(90deg, 
        rgba(147, 197, 253, 0.1) 0%, 
        rgba(147, 197, 253, 0.3) 50%, 
        rgba(147, 197, 253, 0.1) 100%);
    background-size: 200px 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

/* Notification system */
#notification-container {
    pointer-events: none;
    z-index: 9999;
}

#notification-container > div {
    pointer-events: auto;
    will-change: transform;
}

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

.focus\:not-sr-only:focus {
    position: static !important;
    width: auto !important;
    height: auto !important;
    padding: inherit !important;
    margin: inherit !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .bg-soft-blue-50 {
        background-color: #ffffff !important;
    }
    
    .text-gray-600 {
        color: #000000 !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .carousel-slide {
        transform: none !important;
    }
}

/* Focus management */
:focus-visible {
    outline: 2px solid #0ea5e9;
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
    outline: 2px solid #0ea5e9;
    outline-offset: 2px;
}

/* Image aspect ratios */
.aspect-video {
    aspect-ratio: 16 / 9;
}

.aspect-square {
    aspect-ratio: 1 / 1;
}

/* Responsive images */
.responsive-image {
    width: 100%;
    height: auto;
    object-fit: cover;
    object-position: center;
}

/* Touch-friendly interactive elements */
@media (pointer: coarse) {
    button, .btn, .carousel-dot {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Badge styling */
.profile-photo-container .absolute.top-4.right-4 {
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.profile-photo-container .absolute.top-4.right-4:hover {
    transform: scale(1.05);
}