/* Mobile-First Responsive Design & Transitions */

/* CSS Custom Properties for Transitions */
:root {
    --transition-duration: 200ms;
    --transition-easing: cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 150ms;
    --transition-normal: 250ms;
    --transition-slow: 400ms;
}

/* Respect User 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;
    }
}

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

/* Safe Area Insets for Notch/Island Devices */
@supports (padding: max(0px)) {
    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }

    .navbar {
        padding-top: max(0.5rem, env(safe-area-inset-top)) !important;
    }
}

/* Fluid Typography - Mobile First (320px+) */
body {
    font-size: clamp(14px, 2vw, 18px);
    line-height: 1.6;
}

h1 {
    font-size: clamp(24px, 6vw, 48px);
    line-height: 1.2;
    margin-bottom: clamp(0.75rem, 2vw, 1.5rem);
}

h2 {
    font-size: clamp(20px, 5vw, 36px);
    line-height: 1.3;
    margin-bottom: clamp(0.75rem, 2vw, 1.25rem);
}

h3 {
    font-size: clamp(18px, 4vw, 28px);
    line-height: 1.3;
    margin-bottom: clamp(0.5rem, 1.5vw, 1rem);
}

h4 {
    font-size: clamp(16px, 3.5vw, 24px);
    line-height: 1.4;
    margin-bottom: clamp(0.5rem, 1.5vw, 1rem);
}

h5 {
    font-size: clamp(15px, 3vw, 20px);
    line-height: 1.4;
    margin-bottom: clamp(0.5rem, 1vw, 0.75rem);
}

h6 {
    font-size: clamp(14px, 2.5vw, 18px);
    line-height: 1.5;
    margin-bottom: clamp(0.5rem, 1vw, 0.75rem);
}

p {
    font-size: clamp(14px, 2vw, 18px);
    line-height: 1.7;
    margin-bottom: clamp(0.75rem, 2vw, 1rem);
}

.lead {
    font-size: clamp(16px, 3vw, 22px);
    line-height: 1.6;
}

/* Fluid Spacing */
.container {
    padding: clamp(16px, 5vw, 32px) clamp(16px, 4vw, 24px);
}

.section,
.portfolio-block {
    padding: clamp(40px, 8vw, 80px) 0;
}

/* Touch-Friendly Interactive Elements */
button,
.btn,
a.btn,
input[type="submit"],
input[type="button"],
.nav-link {
    min-height: 44px;
    min-width: 44px;
    padding: clamp(0.5rem, 2vw, 0.75rem) clamp(1rem, 4vw, 1.5rem);
    font-size: clamp(14px, 2vw, 16px);
    transition: all var(--transition-duration) var(--transition-easing);
    touch-action: manipulation;
}

/* Base Transitions for Interactive Elements */
button,
.btn,
a,
input,
select,
textarea,
.nav-link,
.card {
    transition: all var(--transition-duration) var(--transition-easing);
}

/* Hover States with Transform */
button:hover,
.btn:hover,
a:hover:not(.nav-link) {
    opacity: 0.9;
    transform: translateY(-2px);
}

button:active,
.btn:active,
a:active {
    transform: translateY(0);
}

/* Focus States for Accessibility */
button:focus-visible,
.btn:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #007bff;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Fade-In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Apply fade-in to main content */
.page > section {
    animation: fadeIn 300ms ease-out forwards;
}

/* Responsive Grid Layouts */
.responsive-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(12px, 3vw, 24px);
}

@media (min-width: 480px) {
    .responsive-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

@media (min-width: 768px) {
    .responsive-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: clamp(16px, 3vw, 24px);
    }
}

/* Responsive Flex Containers */
.responsive-flex {
    display: flex;
    flex-direction: column;
    gap: clamp(8px, 2vw, 16px);
}

@media (min-width: 768px) {
    .responsive-flex {
        flex-direction: row;
        gap: clamp(12px, 2.5vw, 20px);
    }
}

/* Navigation Responsive Styles */
.navbar {
    padding: clamp(0.4rem, 1.5vw, 0.5rem) 0 !important;
}

.navbar-brand {
    font-size: clamp(1rem, 2.5vw, 1.15rem) !important;
}

.navbar-avatar {
    width: clamp(28px, 6vw, 32px) !important;
    height: clamp(28px, 6vw, 32px) !important;
    margin-right: clamp(0.5rem, 1.5vw, 0.75rem) !important;
}

.navbar-nav .nav-link {
    padding: clamp(0.3rem, 1.5vw, 0.35rem) clamp(0.75rem, 3vw, 1rem) !important;
    margin: 0 clamp(0.125rem, 1vw, 0.25rem) !important;
    font-size: clamp(13px, 2vw, 16px) !important;
}

/* Card Responsive Styles */
.card {
    padding: clamp(1rem, 4vw, 1.5rem);
    margin-bottom: clamp(1rem, 3vw, 1.5rem);
    border-radius: clamp(8px, 2vw, 12px);
    transition: all var(--transition-normal) var(--transition-easing);
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
}

/* Button Responsive Styles */
.btn {
    font-size: clamp(14px, 2vw, 16px) !important;
    padding: clamp(0.5rem, 2vw, 0.75rem) clamp(1rem, 4vw, 1.5rem) !important;
    min-height: 44px;
    border-radius: clamp(6px, 1.5vw, 8px);
}

.btn-lg {
    font-size: clamp(16px, 2.5vw, 18px) !important;
    padding: clamp(0.75rem, 2.5vw, 0.875rem) clamp(1.5rem, 5vw, 2rem) !important;
    min-height: 48px;
}

/* Form Elements Responsive */
.form-control {
    font-size: clamp(14px, 2vw, 16px);
    padding: clamp(0.625rem, 2vw, 0.75rem) clamp(0.875rem, 3vw, 1rem);
    min-height: 44px;
    border-radius: clamp(6px, 1.5vw, 10px);
}

textarea.form-control {
    min-height: clamp(100px, 25vw, 120px);
}

/* Container Responsive Padding */
.container {
    padding-left: clamp(16px, 4vw, 24px);
    padding-right: clamp(16px, 4vw, 24px);
}

/* Section Spacing */
section {
    padding: clamp(40px, 8vw, 80px) 0;
}

/* Avatar Responsive */
.avatar {
    width: clamp(150px, 40vw, 257px) !important;
    height: clamp(150px, 40vw, 279px) !important;
}

/* Portfolio Block Responsive */
.portfolio-block {
    padding: clamp(40px, 8vw, 80px) 0;
}

.portfolio-block.block-intro {
    padding: clamp(60px, 12vw, 80px) 0 clamp(40px, 8vw, 60px) 0;
}

.portfolio-block.skills {
    padding: clamp(50px, 10vw, 80px) 0;
}

.portfolio-block.website {
    padding: clamp(50px, 10vw, 80px) 0;
}

/* Heading Responsive */
.heading h2 {
    font-size: clamp(20px, 5vw, 36px);
    margin-bottom: clamp(0.75rem, 2vw, 1.25rem);
}

.heading span {
    font-size: clamp(14px, 2.5vw, 18px);
    line-height: 1.6;
}

/* Card Grid Responsive Spacing */
.row.g-4 {
    margin-left: clamp(-0.5rem, -1vw, -0.5rem);
    margin-right: clamp(-0.5rem, -1vw, -0.5rem);
}

.row.g-4 > [class*="col-"] {
    padding-left: clamp(0.5rem, 1vw, 0.5rem);
    padding-right: clamp(0.5rem, 1vw, 0.5rem);
    margin-bottom: clamp(1rem, 2vw, 1.5rem);
}

/* Tablet Breakpoint (768px) */
@media (min-width: 768px) {
    .row.g-4 > [class*="col-"] {
        margin-bottom: clamp(1rem, 2vw, 1.5rem);
    }

    .container {
        padding-left: clamp(24px, 5vw, 32px);
        padding-right: clamp(24px, 5vw, 32px);
    }

    .navbar-nav {
        gap: clamp(0.25rem, 1vw, 0.5rem) !important;
    }
}

/* Large Tablet / Small Laptop (1024px) */
@media (min-width: 1024px) {
    .container {
        max-width: 1200px;
        padding-left: 2rem;
        padding-right: 2rem;
    }

    .navbar-nav .nav-link {
        padding: 0.35rem 1rem !important;
    }
}

/* Desktop (1280px) */
@media (min-width: 1280px) {
    .container {
        max-width: 1200px;
    }
}

/* Large Desktop (1536px) */
@media (min-width: 1536px) {
    .container {
        max-width: 1400px;
    }
}

/* Mobile Navbar Collapse - Let Bootstrap handle it completely */
@media (max-width: 991px) {
    /* Bootstrap handles the collapse - we just ensure proper display when shown */
    .navbar-collapse.show {
        display: block !important;
    }
}

/* Mobile Specific Adjustments (320px - 479px) */
@media (max-width: 479px) {
    .navbar-brand {
        font-size: clamp(0.9rem, 3vw, 1rem) !important;
    }

    .navbar-avatar {
        width: clamp(28px, 7vw, 32px) !important;
        height: clamp(28px, 7vw, 32px) !important;
        margin-right: clamp(0.375rem, 1.5vw, 0.5rem) !important;
    }

    .btn {
        width: 100%;
        margin-bottom: 0.75rem;
    }

    .btn:last-child {
        margin-bottom: 0;
    }

    .card {
        padding: clamp(0.875rem, 3vw, 1rem);
    }

    .contact-form-container {
        padding: clamp(1.25rem, 4vw, 1.5rem) clamp(0.875rem, 2.5vw, 1rem) !important;
    }

    .contact-form {
        padding: clamp(1.25rem, 4vw, 1.5rem) clamp(0.875rem, 2.5vw, 1rem) !important;
    }

    /* Stack buttons on mobile */
    .text-center .btn,
    .mt-4 .btn {
        width: 100%;
        margin-bottom: 0.75rem;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .text-center .btn:last-child,
    .mt-4 .btn:last-child {
        margin-bottom: 0;
    }
}

/* Performance Optimizations */
.card,
.btn,
.nav-link {
    will-change: transform;
}

.card:hover,
.btn:hover {
    will-change: transform;
}

/* Image Responsive */
img {
    max-width: 100%;
    height: auto;
    display: block;
    transition: opacity var(--transition-duration) var(--transition-easing);
}

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

img[loading="lazy"].loaded {
    opacity: 1;
}

/* Background images responsive */
.avatar,
[style*="background-image"],
[style*="background: url"] {
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

/* Utility Classes for Responsive Spacing */
.mt-responsive {
    margin-top: clamp(1rem, 3vw, 2rem);
}

.mb-responsive {
    margin-bottom: clamp(1rem, 3vw, 2rem);
}

.p-responsive {
    padding: clamp(1rem, 3vw, 2rem);
}

.px-responsive {
    padding-left: clamp(1rem, 3vw, 2rem);
    padding-right: clamp(1rem, 3vw, 2rem);
}

.py-responsive {
    padding-top: clamp(1rem, 3vw, 2rem);
    padding-bottom: clamp(1rem, 3vw, 2rem);
}

/* Gap Responsive */
.gap-responsive {
    gap: clamp(0.75rem, 2vw, 1.5rem);
}

/* Footer Migration Pages Section */
.footer-nav-migration {
    margin-top: clamp(0.5rem, 1.5vw, 1rem);
    padding-top: clamp(0.75rem, 2vw, 1rem);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 100%;
    flex-wrap: wrap;
    padding-left: 1rem;
    padding-right: 1rem;
    box-sizing: border-box;
}

.footer-nav-link-migration {
    font-size: clamp(12px, 1.8vw, 14px) !important;
    opacity: 0.85;
    white-space: nowrap;
    flex-shrink: 0;
}

.footer-nav-link-migration:hover {
    opacity: 1;
}

/* Footer Responsive Improvements */
@media (max-width: 768px) {
    .footer-nav,
    .footer-nav-migration {
        justify-content: center;
        gap: clamp(0.375rem, 1.5vw, 0.75rem);
    }
    
    .footer-nav-link,
    .footer-nav-link-migration {
        white-space: normal;
        word-break: break-word;
        text-align: center;
        padding: 0.25rem 0.375rem;
        font-size: clamp(11px, 1.6vw, 13px) !important;
    }
}

@media (max-width: 480px) {
    .footer-nav,
    .footer-nav-migration {
        gap: clamp(0.25rem, 1vw, 0.5rem);
        padding: 0 0.5rem;
    }
    
    .footer-nav-link,
    .footer-nav-link-migration {
        font-size: clamp(10px, 1.4vw, 12px) !important;
        padding: 0.2rem 0.3rem;
    }
    
    .footer-row {
        padding: 0 0.5rem;
    }
}

/* Dark mode support for footer migration border */
@media (prefers-color-scheme: dark) {
    .footer-nav-migration {
        border-top-color: rgba(255, 255, 255, 0.1);
    }
}

