/* Custom styles for luxury portfolio */

/* Ripple animation for project cards */
@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Preloader animations */
#preloader {
    backdrop-filter: blur(10px);
    z-index: 9999;
}

/* Enhanced button animations */
.cta-button {
    transform-style: preserve-3d;
    position: relative;
    overflow: hidden;
}

.cta-button:active {
    transform: scale(0.98);
}

/* Fade in animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.animate-fade-in {
    animation: fadeIn 0.8s ease-out;
}

.animate-slide-up {
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

/* Stagger animations for project cards */
.project-card:nth-child(1) {
    animation: fadeInUp 0.6s ease-out 0.1s both;
}

.project-card:nth-child(2) {
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.project-card:nth-child(3) {
    animation: fadeInUp 0.6s ease-out 0.3s both;
}

.project-card:nth-child(4) {
    animation: fadeInUp 0.6s ease-out 0.4s both;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom button hover effects */
.cta-button {
    position: relative;
    overflow: hidden;
}

.cta-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s;
}

.cta-button:hover::before {
    left: 100%;
}

/* Clean project card hover effects - prevent overlapping */
.project-card {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
    will-change: transform, box-shadow;
    isolation: isolate;
    contain: layout style paint;
}

/* Under development project styling */
.project-card.under-development {
    filter: blur(2px);
    opacity: 0.7;
    pointer-events: none;
    cursor: not-allowed;
}

.project-card.under-development:hover {
    filter: blur(2px);
    opacity: 0.7;
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.project-card:hover {
    /* Removed hover effects to match clean style */
    transform: none;
    box-shadow: inherit;
    z-index: 1;
}

.project-card:hover h3 {
    color: #374151;
}

.project-card:focus-within {
    /* Removed focus effects to match clean style */
    transform: none;
    box-shadow: inherit;
    outline: none;
    z-index: 1;
}

/* Prevent text overlap during scroll */
.project-card h2,
.project-card h3,
.project-card p {
    position: relative;
    z-index: 1;
}

.project-card > div:first-child {
    transition: transform 0.3s ease;
    overflow: hidden;
    position: relative;
    z-index: 0;
}

.project-card:hover > div:first-child > div {
    /* Removed scale transform to disable zoom effect */
    transform: none;
}

/* Fix text overlapping during scroll */
.text-center {
    position: relative;
    z-index: 3;
}

/* Hero section text should not interfere */
main .text-center {
    z-index: 1;
}

/* Work section text gets higher priority */
#work .text-center {
    z-index: 5;
}

/* Portfolio badge specific fix */
#work .inline-block {
    position: relative;
    z-index: 6;
    background-color: white;
    isolation: isolate;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Intersection Observer animations */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease;
}

.fade-in-up.visible {
    opacity: 1;
    transform: translateY(0);
}

.fade-in {
    opacity: 0;
    transition: opacity 0.8s ease;
}

.fade-in.visible {
    opacity: 1;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Mobile navigation */
.mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: min(20rem, 85vw);
    height: 100vh;
    background: white;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 70;
    padding: 1.5rem;
    transform: translateX(100%);
    transition: transform 0.3s ease-out;
    overflow-y: auto;
}

@media (max-width: 480px) {
    .mobile-menu {
        width: min(18rem, 90vw);
        padding: 1rem;
    }
}

.mobile-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 60;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    touch-action: none;
}

.mobile-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

/* Navigation positioning - fix overlapping */
nav {
    z-index: 50;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    isolation: isolate;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    width: 100%;
    margin: 0;
}

/* Mobile navigation improvements */
@media (max-width: 768px) {
    nav .max-w-7xl {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    nav .flex {
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }
    
    nav .font-semibold {
        font-size: 1.125rem;
        flex-shrink: 0;
    }
    
    nav button {
        padding: 0.5rem;
        margin-left: auto;
        flex-shrink: 0;
    }
    
    nav .hidden.md\:flex {
        display: none !important;
    }
}

/* Tablet navigation */
@media (min-width: 769px) and (max-width: 1024px) {
    nav .max-w-7xl {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
    
    nav .space-x-8 > * + * {
        margin-left: 1.5rem;
    }
}

/* Fix section stacking and prevent overlapping */
section {
    position: relative;
    z-index: 1;
    isolation: isolate;
    width: 100%;
    max-width: 100vw;
    margin: 0 auto;
}

/* Hero section - proper centering for all viewport sizes */
.hero-section {
    z-index: 0;
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 1rem;
    box-sizing: border-box;
}

.hero-content {
    text-align: center;
    max-width: 64rem;
    width: 100%;
    margin: 0 auto;
    padding: 0 1rem;
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

*:focus {
    outline: none !important;
    box-shadow: none !important;
}

* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

p, h1, h2, h3, h4, h5, h6, span, div {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

button:focus,
a:focus,
input:focus,
textarea:focus,
select:focus {
    outline: none !important;
    box-shadow: none !important;
    border-color: inherit !important;
}

.project-card,
.project-card *,
.featured-project,
.featured-project *,
article,
article *,
.card,
.card {
    /* Card styles without affecting text selection */
    -webkit-tap-highlight-color: transparent !important;
    -webkit-touch-callout: none !important;
}

/* Allow text selection in card content */
.card p,
.card h1,
.card h2,
.card h3,
.card h4,
.card h5,
.card h6,
.card span,
.card div {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
}

.project-card:active,
.project-card:focus,
.project-card *:active,
.project-card *:focus,
.featured-project:active,
.featured-project:focus,
.featured-project *:active,
.featured-project *:focus,
article:active,
article:focus,
article *:active,
article *:focus,
.card:active,
.card:focus,
.card *:active,
.card *:focus {
    outline: none !important;
    box-shadow: none !important;
    background-color: inherit !important;
    transform: none !important;
    border: inherit !important;
}

@media (min-width: 640px) {
    .hero-section {
        padding: 5rem 1.5rem;
    }
    .hero-content {
        padding: 0 1.5rem;
    }
}

@media (min-width: 1024px) {
    .hero-section {
        padding: 6rem 2rem;
    }
    .hero-content {
        padding: 0 2rem;
    }
}

/* Work section - higher z-index to stay above hero */
#work {
    z-index: 10;
    position: relative;
    background-color: #f9fafb;
    isolation: isolate;
    margin-top: 0;
    clear: both;
    width: 100%;
    max-width: 100vw;
}

#work .max-w-7xl {
    position: relative;
    z-index: 1;
}

/* Ensure work section content stays above everything */
#work h2,
#work p,
#work .project-card {
    position: relative;
    z-index: 2;
}

/* Prevent content shift on hover and ensure proper centering */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    width: 100%;
    height: 100%;
}

body {
    overflow-x: hidden;
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* Ensure main content takes full width */
main {
    width: 100%;
    flex: 1;
}

/* Center all container elements */
.max-w-7xl,
.max-w-6xl,
.max-w-4xl,
.max-w-2xl {
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

/* Loading animation for images */
.image-placeholder {
    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;
    }
}

/* Enhanced focus states for accessibility */
button:focus,
a:focus {
    outline: 2px solid #000;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Focus visible for better UX */
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
    outline: none;
}

button:focus-visible,
a:focus-visible {
    outline: 2px solid #000;
    outline-offset: 2px;
}

/* Reduced 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;
    }
    
    html {
        scroll-behavior: auto;
    }
    
    #preloader {
        display: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .text-gray-600 {
        color: #000;
    }
    
    .text-gray-400 {
        color: #666;
    }
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Button and link consistency */
button, a {
    font-family: inherit;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

button:focus-visible,
a:focus-visible {
    outline: 2px solid #3B82F6;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Navigation link hover */
nav a {
    position: relative;
    border-radius: 6px;
}

nav a:hover {
    background-color: rgba(0, 0, 0, 0.04);
    color: #111827;
}

nav a:active {
    background-color: rgba(0, 0, 0, 0.08);
}

/* Consistent spacing system */
.section-padding {
    padding: 4rem 1rem;
}

@media (min-width: 640px) {
    .section-padding {
        padding: 5rem 1.5rem;
    }
}

@media (min-width: 1024px) {
    .section-padding {
        padding: 6rem 2rem;
    }
}

/* Hover effects for interactive elements */
.bg-white:hover {
    background-color: #FAFAFA;
}

/* Typography improvements */
.text-gradient {
    background: linear-gradient(135deg, #1f2937 0%, #4b5563 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Responsive typography */
@media (max-width: 640px) {
    h1 {
        font-size: clamp(2rem, 8vw, 3rem);
        line-height: 1.1;
    }
    
    h2 {
        font-size: clamp(1.5rem, 6vw, 2.25rem);
        line-height: 1.2;
    }
    
    p {
        font-size: clamp(1rem, 4vw, 1.125rem);
        line-height: 1.6;
    }
}

/* Card component consistency */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

/* Icon consistency */
svg {
    flex-shrink: 0;
}

/* Ensure proper text wrapping */
p, span, div {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Performance optimizations */
.project-card,
.card,
button,
a {
    contain: layout style;
}

/* Remove animations for reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .project-card:hover {
        transform: none;
    }
}

/* Print styles */
@media print {
    .fixed,
    nav,
    footer {
        display: none;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
    }
    
    h1, h2, h3 {
        page-break-after: avoid;
    }
    
    .bg-gradient-to-r,
    .bg-gradient-to-br,
    .bg-gradient-to-b {
        background: #f5f5f5 !important;
    }
}
