/* ===================================
   CUSTOM ANIMATIONS & EFFECTS
   =================================== */

/* Loading Animation */
.loader {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(232, 220, 196, 0.2);
    border-top-color: #E8DCC4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Geometric Background Shapes */
.geometric-shape {
    position: absolute;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    animation: morph 15s ease-in-out infinite;
}

.shape-1 {
    width: 400px;
    height: 400px;
    top: 10%;
    right: 10%;
    animation-delay: 0s;
}

.shape-2 {
    width: 300px;
    height: 300px;
    bottom: 20%;
    left: 5%;
    animation-delay: 5s;
}

.shape-3 {
    width: 250px;
    height: 250px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 10s;
}

@keyframes morph {
    0%, 100% {
        border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
        transform: rotate(0deg) scale(1);
    }
    25% {
        border-radius: 58% 42% 75% 25% / 76% 46% 54% 24%;
        transform: rotate(90deg) scale(1.1);
    }
    50% {
        border-radius: 50% 50% 33% 67% / 55% 27% 73% 45%;
        transform: rotate(180deg) scale(0.9);
    }
    75% {
        border-radius: 33% 67% 58% 42% / 63% 68% 32% 37%;
        transform: rotate(270deg) scale(1.05);
    }
}

/* Scroll Reveal Animations */
.reveal-fade {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-fade.revealed,
.reveal-left.revealed,
.reveal-right.revealed,
.reveal-scale.revealed {
    opacity: 1;
    transform: translateY(0) translateX(0) scale(1);
}

/* Navbar Blur Effect */
.navbar-scrolled {
    background: rgba(245, 240, 232, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Filter Buttons */
.filter-btn {
    background: transparent;
    color: #3D3935;
    border: 2px solid #E8DCC4;
}

.filter-btn:hover {
    background: #E8DCC4;
    border-color: #E8DCC4;
    transform: translateY(-2px);
}

.filter-btn.active {
    background: #6B9FA3;
    color: white;
    border-color: #6B9FA3;
}

/* Portfolio Card Hover Effect */
.portfolio-card {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    cursor: pointer;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

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

.portfolio-card img {
    transition: transform 0.6s ease;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.portfolio-card:hover img {
    transform: scale(1.1);
}

.portfolio-card .overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(45, 42, 38, 0.95), rgba(45, 42, 38, 0) 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.5rem;
}

.portfolio-card:hover .overlay {
    opacity: 1;
}

/* Mobile: Always show overlay for better touch experience */
@media (max-width: 768px) {
    .portfolio-card .overlay {
        opacity: 1;
        background: linear-gradient(to top, rgba(45, 42, 38, 0.85), rgba(45, 42, 38, 0) 60%);
        padding: 1rem;
    }

    .portfolio-card:active {
        transform: scale(0.98);
    }
}

/* Skill Bar Animation */
.skill-bar {
    width: 0 !important;
    transition: width 1.5s ease-in-out;
}

.skill-item.animated .skill-bar {
    width: var(--skill-width) !important;
}

/* Portfolio Grid Animation */
.portfolio-item {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.portfolio-item.show {
    opacity: 1;
    transform: scale(1);
}

.portfolio-item.hide {
    display: none;
}

/* Modal Animation */
#project-modal {
    animation: fadeIn 0.3s ease;
}

#project-modal > div {
    animation: slideUp 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Smooth Scroll Behavior */
html {
    scroll-behavior: smooth;
}

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

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

::-webkit-scrollbar-thumb {
    background: #6B9FA3;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #81A9AD;
}

/* Mobile Menu Slide Animation */
#mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

#mobile-menu.open {
    max-height: 500px;
}

/* Button Hover Effects */
.btn-primary:hover {
    box-shadow: 0 10px 25px rgba(107, 159, 163, 0.4);
}

.btn-secondary:hover {
    box-shadow: 0 10px 25px rgba(45, 42, 38, 0.2);
}

/* Image Hover Effect */
img {
    transition: transform 0.3s ease, filter 0.3s ease;
}

img:hover {
    filter: brightness(1.05);
}

/* Focus Styles for Accessibility */
a:focus,
button:focus,
input:focus,
textarea:focus {
    outline: 3px solid #6B9FA3;
    outline-offset: 2px;
}

/* Loading Screen Fade Out */
#loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

/* Responsive Typography */
@media (max-width: 768px) {
    .geometric-shape {
        display: none;
    }

    /* Smaller text on mobile */
    h1 {
        line-height: 1.2;
    }

    h2 {
        line-height: 1.3;
    }

    /* Prevent horizontal scroll */
    body {
        overflow-x: hidden;
    }

    /* Adjust modal for mobile */
    #project-modal > div {
        max-height: 85vh;
    }

    /* Better touch targets for mobile */
    button, a {
        min-height: 44px;
        min-width: 44px;
    }

    /* Reduce animation on mobile for performance */
    *, *::before, *::after {
        animation-duration: 0.5s !important;
        transition-duration: 0.3s !important;
    }
}

/* Portfolio Category Badge */
.category-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* Gradient Text Effect */
.gradient-text {
    background: linear-gradient(135deg, #6B9FA3 0%, #C85A4F 50%, #E9B44C 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Diagonal Section Divider */
.diagonal-divider {
    position: relative;
}

.diagonal-divider::before {
    content: '';
    position: absolute;
    top: -50px;
    left: 0;
    right: 0;
    height: 100px;
    background: inherit;
    transform: skewY(-2deg);
    transform-origin: top left;
}

/* Card Shine Effect */
@keyframes shine {
    to {
        background-position: 200% center;
    }
}

.shine-effect {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    background-size: 200% auto;
    animation: shine 3s linear infinite;
}

/* Pulse Animation for CTA */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(107, 159, 163, 0.7);
    }
    50% {
        box-shadow: 0 0 0 20px rgba(107, 159, 163, 0);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

/* Stagger Animation Delay */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }
.stagger-6 { animation-delay: 0.6s; }

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
}

/* Touch-Friendly Enhancements */
.touch-manipulation {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Smooth scrolling for all devices */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Additional Mobile Optimizations */
@media (max-width: 640px) {
    /* Smaller container padding on very small screens */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Stack filter buttons better on small screens */
    .filter-btn {
        white-space: nowrap;
        font-size: 0.813rem;
    }

    /* Optimize portfolio card spacing */
    .portfolio-card .overlay {
        padding: 0.75rem;
    }

    .category-badge {
        font-size: 0.75rem;
        padding: 0.15rem 0.5rem;
    }

    /* Better form input sizing on mobile */
    input, textarea, button {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Tablet specific adjustments */
@media (min-width: 641px) and (max-width: 1024px) {
    .portfolio-card .overlay {
        padding: 1.25rem;
    }
}

/* Landscape mobile adjustments */
@media (max-width: 896px) and (orientation: landscape) {
    .min-h-screen {
        min-height: auto;
        padding-top: 4rem;
        padding-bottom: 4rem;
    }

    /* Hide scroll indicator in landscape */
    .scroll-indicator {
        display: none !important;
    }
}
