* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
    --primary: #4a6fa5;
    --secondary: #6b8cbc;
    --accent: #ff7e5f;
    --light: #f8f9fa;
    --dark: #2c3e50;
    --transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* FIX: Body and HTML overflow control */
html, body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--dark);
    overflow-x: hidden;
    perspective: 1000px;
    min-height: 100vh;
    position: relative;
}

/* FIX: Clear any floats or extra space */
body::after {
    content: '';
    display: table;
    clear: both;
}

.parallax-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh; /* FIX: Limit to viewport height */
    z-index: -1;
    transform-style: preserve-3d;
    overflow: hidden; /* FIX: Prevent overflow */
}

.bg-layer {
    position: absolute;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><circle cx="50" cy="50" r="2" fill="%234a6fa5" opacity="0.1"/></svg>');
    transform: translateZ(-10px) scale(2);
}

.bg-layer-2 {
    position: absolute;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="60" height="60" viewBox="0 0 60 60"><circle cx="30" cy="30" r="1.5" fill="%236b8cbc" opacity="0.05"/></svg>');
    transform: translateZ(-5px) scale(1.5);
}

/* FIX: Container overflow control */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    transform-style: preserve-3d;
    position: relative;
    overflow: hidden; /* FIX: Prevent child elements from creating extra space */
}

header {
    padding: 30px 0;
    position: relative;
    z-index: 10;
    transform-style: preserve-3d;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 15px;
    transform: translateZ(20px);
}

.logo {
    width: 150px;
    height: 150px;
    background: transparent !important;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: none !important;
    transform: rotateY(0deg);
    transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: visible;
}

.logo:hover {
    transform: rotateY(180deg);
}

.logo-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 0;
    border-radius: 0;
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.1));
    transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo-text {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    position: relative;
}

nav {
    margin-top: 20px;
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
}

nav a {
    text-decoration: none;
    color: var(--dark);
    font-weight: 600;
    padding: 10px 15px;
    border-radius: 30px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

nav a:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--primary);
    z-index: -1;
    transition: var(--transition);
    border-radius: 30px;
}

nav a:hover {
    color: white;
    transform: translateY(-5px);
}

nav a:hover:before {
    left: 0;
}

/* Image Slider Styles */
.slider-container {
    width: 100%;
    height: 500px;
    position: relative;
    margin: 30px 0 80px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    transform-style: preserve-3d;
    transform: translateZ(10px);
}

.slider {
    width: 100%;
    height: 100%;
    position: relative;
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1s ease;
    background-size: cover;
    background-position: center;
    transform-style: preserve-3d;
}

.slide.active {
    opacity: 1;
}

.slide-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 40px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white;
    transform: translateZ(30px);
}

.slide-content h2 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.slide-content p {
    font-size: 1.2rem;
    max-width: 600px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.slider-nav {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 10;
}

.slider-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: var(--transition);
}

.slider-dot.active {
    background: white;
    transform: scale(1.2);
}

.slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    z-index: 10;
    backdrop-filter: blur(5px);
}

.slider-arrow:hover {
    background: rgba(255,255,255,0.4);
    transform: translateY(-50%) scale(1.1);
}

.slider-arrow.prev {
    left: 20px;
}

.slider-arrow.next {
    right: 20px;
}

.hero {
    padding: 100px 0;
    text-align: center;
    position: relative;
    transform-style: preserve-3d;
}

.hero h1 {
    font-size: 4rem;
    margin-bottom: 20px;
    color: var(--dark);
    text-shadow: 3px 3px 6px rgba(0,0,0,0.1);
    transform: translateZ(30px);
    opacity: 0;
    transition: opacity 1s ease;
}

.hero p {
    font-size: 1.5rem;
    max-width: 700px;
    margin: 0 auto 40px;
    color: var(--dark);
    transform: translateZ(20px);
    opacity: 0;
    transition: opacity 1s ease 0.3s;
}

.cta-button {
    display: inline-block;
    padding: 15px 40px;
    background: var(--accent);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1.2rem;
    box-shadow: 0 10px 20px rgba(255,126,95,0.3);
    transition: var(--transition);
    transform: translateZ(40px);
    opacity: 0;
    transition: opacity 1s ease 0.6s, transform 0.3s ease;
}

.cta-button:hover {
    transform: translateY(-10px) translateZ(50px);
    box-shadow: 0 15px 30px rgba(255,126,95,0.5);
}

.floating-cards {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 80px 0;
    transform-style: preserve-3d;
}

.card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
    width: 300px;
    transition: var(--transition);
    transform-style: preserve-3d;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(50px);
}

.card:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: var(--primary);
}

.card:hover {
    transform: translateY(-20px) rotateY(10deg);
    box-shadow: 0 25px 50px rgba(0,0,0,0.15);
}

.card h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: var(--primary);
}

.card p {
    color: #666;
    line-height: 1.6;
}

.card-icon {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 20px;
}

.services {
    padding: 80px 0;
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(10px);
    margin: 60px 0;
    transform-style: preserve-3d;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 60px;
    color: var(--dark);
    transform: translateZ(20px);
}

/* FIX: Service items transform origin and performance */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    perspective: 1000px;
}

.service-item {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 40px 30px;
    border-radius: 20px;
    box-shadow: 
        0 10px 30px rgba(0,0,0,0.08),
        inset 0 1px 0 rgba(255,255,255,0.8);
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    transform-style: preserve-3d;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.2);
    opacity: 0;
    transform: translateY(50px) scale(0.95);
    transform-origin: center center; /* FIX: Prevent transforms from pushing content */
    backface-visibility: hidden; /* FIX: Improve performance and prevent layout shifts */
}

.service-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.8s ease;
}

.service-item:hover::before {
    left: 100%;
}

.service-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px;
    color: white;
    font-size: 2rem;
    box-shadow: 0 10px 25px rgba(74, 111, 165, 0.3);
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    transform: translateZ(30px);
}

.service-item h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: var(--dark);
    text-align: center;
    transition: all 0.4s ease;
    transform: translateZ(20px);
}

.service-item p {
    color: #666;
    line-height: 1.7;
    text-align: center;
    transition: all 0.4s ease;
    transform: translateZ(10px);
}

.service-hover-effect {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, 
        rgba(74, 111, 165, 0.1) 0%, 
        rgba(255, 126, 95, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    border-radius: 20px;
}

/* FIX: Service items hover with will-change for performance */
.service-item:hover {
    transform: 
        translateY(-15px) 
        scale(1.05) 
        rotateX(5deg) 
        rotateY(5deg);
    box-shadow: 
        0 25px 50px rgba(74, 111, 165, 0.2),
        0 15px 30px rgba(255, 126, 95, 0.15),
        inset 0 1px 0 rgba(255,255,255,0.8);
    background: linear-gradient(135deg, #ffffff 0%, #f0f4f8 100%);
    border-color: rgba(74, 111, 165, 0.1);
    will-change: transform; /* FIX: Better performance */
}

.service-item:hover .service-icon {
    transform: 
        translateZ(50px) 
        scale(1.2) 
        rotateY(180deg);
    box-shadow: 
        0 15px 35px rgba(74, 111, 165, 0.4),
        0 5px 15px rgba(255, 126, 95, 0.3);
    background: linear-gradient(135deg, var(--accent), #ff9e7d);
}

.service-item:hover .service-hover-effect {
    opacity: 1;
}

.service-item:hover h3 {
    color: var(--primary);
    transform: translateZ(30px) scale(1.1);
}

.service-item:hover p {
    color: #555;
    transform: translateZ(20px);
}

/* Animation when scrolling into view */
.service-item.animate {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Staggered animation delay */
.service-item:nth-child(1) { transition-delay: 0.1s; }
.service-item:nth-child(2) { transition-delay: 0.2s; }
.service-item:nth-child(3) { transition-delay: 0.3s; }
.service-item:nth-child(4) { transition-delay: 0.4s; }
.service-item:nth-child(5) { transition-delay: 0.5s; }
.service-item:nth-child(6) { transition-delay: 0.6s; }

.service-item h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: var(--primary);
}

.youtube-section {
    padding: 80px 0;
    transform-style: preserve-3d;
}

.youtube-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

.video-player {
    width: 100%;
    max-width: 800px;
    height: 450px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    transform: rotateY(-5deg) translateZ(30px);
    transition: var(--transition);
    opacity: 0;
    transform: translateY(30px) rotateY(-5deg);
}

.video-player:hover {
    transform: rotateY(0deg) translateZ(40px);
    box-shadow: 0 25px 50px rgba(0,0,0,0.3);
}

.video-player iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.about {
    padding: 80px 0;
    transform-style: preserve-3d;
}

.about-content {
    display: flex;
    align-items: center;
    gap: 50px;
}

.about-text {
    flex: 1;
    transform: translateZ(20px);
    opacity: 0;
    transform: translateY(30px);
}

.about-text h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: var(--dark);
}

.about-text p {
    line-height: 1.8;
    margin-bottom: 20px;
    color: #555;
}

.about-image {
    flex: 1;
    height: 400px;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    transform: rotateY(-10deg) translateZ(30px);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(30px) rotateY(-10deg);
}

.about-image:hover {
    transform: rotateY(0deg) translateZ(40px);
}

.about-image:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M30,30 Q50,10 70,30 T90,50 T70,70 T50,90 T30,70 T10,50 T30,30 Z" fill="white" opacity="0.1"/></svg>');
}

/* FIX: Footer - Remove transforms and ensure proper positioning */
footer {
    background: var(--dark);
    color: white;
    padding: 50px 20px 20px;
    text-align: center;
    position: relative;
    z-index: 10;
    transform: none !important; /* FIX: Remove any transforms causing space */
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 40px;
    margin: 0 auto 40px;
    max-width: 1100px;
    padding: 0 20px;
}

.footer-column {
    flex: 1;
    min-width: 250px;
    max-width: 300px;
    margin: 0;
    padding: 0;
    text-align: center;
}

.footer-center {
    flex: 1.5;
    max-width: 350px;
}

.footer-section {
    padding: 25px 20px;
    margin: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.footer-column h3 {
    font-size: 1.3rem;
    margin: 0 0 20px 0;
    padding: 0 0 12px 0;
    color: var(--accent);
    position: relative;
    text-align: center;
    width: 100%;
}

.footer-column h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background: var(--accent);
}

.footer-center p {
    font-size: 1.05rem;
    line-height: 1.7;
    margin: 0 0 25px 0;
    padding: 0;
    color: #e0e0e0;
    flex-grow: 1;
    text-align: center;
    width: 100%;
}

.social-icons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 15px 0 0 0;
    padding: 0;
    flex-wrap: wrap;
    width: 100%;
}

.social-icons a {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: #ccc;
    text-decoration: none;
}

.contact-item {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin: 0 0 15px 0;
    padding: 5px 0;
    text-align: center;
    width: 100%;
}

.contact-item .fas {
    color: var(--accent);
    font-size: 1rem;
    margin: 0;
    padding: 0;
    min-width: 20px;
    text-align: center;
}

.contact-item span {
    line-height: 1.5;
    margin: 0;
    padding: 0;
    text-align: center;
    flex: 1;
    max-width: 200px;
}

.quick-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding: 0;
    align-items: center;
    width: 100%;
}

.quick-links a {
    color: #ccc;
    text-decoration: none;
    transition: all 0.3s ease;
    margin: 0;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: block;
    text-align: center;
    width: 100%;
}

.quick-links a:last-child {
    border-bottom: none;
}

.quick-links a:hover {
    color: var(--accent);
    transform: translateY(-2px);
}

.copyright {
    text-align: center;
    margin: 0 auto;
    padding: 25px 20px 0 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: #999;
    max-width: 1100px;
}

.copyright p {
    margin: 0;
    padding: 0;
    font-size: 0.9rem;
}

/* Logo Text with Popup Effect */
.popup-text {
    display: inline-block;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
}

.popup-text span {
    display: inline-block;
    transition: transform 0.3s ease, color 0.3s ease;
    position: relative;
}

.popup-text:hover {
    transform: translateY(-5px);
    text-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.popup-text:hover span {
    animation: popupLetter 0.6s ease forwards;
}

/* Different delays for each letter */
.popup-text span:nth-child(1) { animation-delay: 0.0s; }
.popup-text span:nth-child(2) { animation-delay: 0.05s; }
.popup-text span:nth-child(3) { animation-delay: 0.1s; }
.popup-text span:nth-child(4) { animation-delay: 0.15s; }
.popup-text span:nth-child(5) { animation-delay: 0.2s; }
.popup-text span:nth-child(6) { animation-delay: 0.25s; }
.popup-text span:nth-child(7) { animation-delay: 0.3s; }
.popup-text span:nth-child(8) { animation-delay: 0.35s; }
.popup-text span:nth-child(9) { animation-delay: 0.4s; }
.popup-text span:nth-child(10) { animation-delay: 0.45s; }
.popup-text span:nth-child(11) { animation-delay: 0.5s; }
.popup-text span:nth-child(12) { animation-delay: 0.55s; }
.popup-text span:nth-child(13) { animation-delay: 0.6s; }
.popup-text span:nth-child(14) { animation-delay: 0.65s; }
.popup-text span:nth-child(15) { animation-delay: 0.7s; }
.popup-text span:nth-child(16) { animation-delay: 0.75s; }
.popup-text span:nth-child(17) { animation-delay: 0.8s; }
.popup-text span:nth-child(18) { animation-delay: 0.85s; }
.popup-text span:nth-child(19) { animation-delay: 0.9s; }
.popup-text span:nth-child(20) { animation-delay: 0.95s; }
.popup-text span:nth-child(21) { animation-delay: 1.0s; }
.popup-text span:nth-child(22) { animation-delay: 1.05s; }
.popup-text span:nth-child(23) { animation-delay: 1.1s; }
.popup-text span:nth-child(24) { animation-delay: 1.15s; }
.popup-text span:nth-child(25) { animation-delay: 1.2s; }
.popup-text span:nth-child(26) { animation-delay: 1.25s; }
.popup-text span:nth-child(27) { animation-delay: 1.3s; }
.popup-text span:nth-child(28) { animation-delay: 1.35s; }
.popup-text span:nth-child(29) { animation-delay: 1.4s; }
.popup-text span:nth-child(30) { animation-delay: 1.45s; }
.popup-text span:nth-child(31) { animation-delay: 1.5s; }
.popup-text span:nth-child(32) { animation-delay: 1.55s; }
.popup-text span:nth-child(33) { animation-delay: 1.6s; }
.popup-text span:nth-child(34) { animation-delay: 1.65s; }
.popup-text span:nth-child(35) { animation-delay: 1.7s; }
.popup-text span:nth-child(36) { animation-delay: 1.75s; }
.popup-text span:nth-child(37) { animation-delay: 1.8s; }
.popup-text span:nth-child(38) { animation-delay: 1.85s; }
.popup-text span:nth-child(39) { animation-delay: 1.9s; }
.popup-text span:nth-child(40) { animation-delay: 1.95s; }

@keyframes popupLetter {
    0% {
        transform: translateY(0) scale(1);
        color: var(--dark);
    }
    50% {
        transform: translateY(-8px) scale(1.2);
        color: var(--accent);
        text-shadow: 0 5px 15px rgba(255,126,95,0.4);
    }
    100% {
        transform: translateY(-3px) scale(1.1);
        color: var(--primary);
        text-shadow: 0 3px 10px rgba(74,111,165,0.3);
    }
}

.popup-text:not(:hover) span {
    animation: resetLetter 0.4s ease forwards;
}

@keyframes resetLetter {
    0% {
        transform: translateY(-3px) scale(1.1);
        color: var(--primary);
    }
    100% {
        transform: translateY(0) scale(1);
        color: var(--dark);
    }
}

/* Right Side - Pure Image Content with Auto-Scaling */
.about-image {
    position: sticky;
    top: 100px;
    height: fit-content;
}

.image-container {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    margin-bottom: 25px;
    background: #f8f9fa;
}

.profile-photo {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: contain;
    object-position: center;
    display: block;
    transition: transform 0.5s ease;
    background: linear-gradient(135deg, #f5f7fa, #c3cfe2);
}

.image-container:hover .profile-photo {
    transform: scale(1.02);
}

.image-container {
    aspect-ratio: 3/4;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-photo {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    color: white;
    padding: 30px 25px;
    transform: translateY(0);
    transition: transform 0.3s ease;
}

.image-container:hover .image-overlay {
    transform: translateY(-5px);
}

.overlay-content h4 {
    font-size: 1.4rem;
    margin-bottom: 5px;
    color: white;
}

.overlay-content p {
    color: rgba(255,255,255,0.9);
    margin-bottom: 15px;
    font-size: 1rem;
}

.expertise-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.expertise-tags span {
    background: rgba(255,255,255,0.2);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.3);
}

.professional-gallery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.gallery-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    background: #f8f9fa;
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-item img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 10px;
    font-size: 0.8rem;
    text-align: center;
}

.profile-photo[src=""],
.profile-photo:not([src]) {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.profile-photo[src=""]::after,
.profile-photo:not([src])::after {
    content: "Dr. N. Kumaranyake";
    text-align: center;
    padding: 20px;
}

/* Mobile Touch Effects */
@media (max-width: 768px) {
    .services-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 0 10px;
    }
    
    .service-item {
        padding: 30px 20px;
        transform: translateY(30px) scale(0.98);
    }
    
    .service-item:active,
    .service-item.touch-active {
        transform: 
            translateY(-8px) 
            scale(1.03) 
            rotateX(3deg) 
            rotateY(3deg) !important;
        box-shadow: 
            0 20px 40px rgba(74, 111, 165, 0.25),
            0 12px 25px rgba(255, 126, 95, 0.2),
            inset 0 1px 0 rgba(255,255,255,0.8) !important;
        background: linear-gradient(135deg, #ffffff 0%, #f0f4f8 100%) !important;
        transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1) !important;
    }
    
    .service-item:active .service-icon,
    .service-item.touch-active .service-icon {
        transform: 
            translateZ(40px) 
            scale(1.15) 
            rotateY(180deg) !important;
        box-shadow: 
            0 12px 30px rgba(74, 111, 165, 0.4),
            0 4px 12px rgba(255, 126, 95, 0.3) !important;
        background: linear-gradient(135deg, var(--accent), #ff9e7d) !important;
        transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1) !important;
    }
    
    .service-item:active .service-hover-effect,
    .service-item.touch-active .service-hover-effect {
        opacity: 1 !important;
        transition: opacity 0.2s ease !important;
    }
    
    .service-item:active h3,
    .service-item.touch-active h3 {
        color: var(--primary) !important;
        transform: translateZ(25px) scale(1.05) !important;
    }
    
    .service-item:hover {
        transform: translateY(0) scale(1);
    }
    
    .service-item::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: rgba(74, 111, 165, 0.1);
        transform: translate(-50%, -50%);
        transition: width 0.3s ease, height 0.3s ease;
    }
    
    .service-item:active::after,
    .service-item.touch-active::after {
        width: 300px;
        height: 300px;
        opacity: 0;
        transition: width 0.3s ease, height 0.3s ease, opacity 0.3s ease;
    }

    .hero h1 {
        font-size: 2.5rem;
    }
    
    .floating-cards {
        flex-direction: column;
        align-items: center;
    }
    
    .about-content {
        flex-direction: column;
    }
    
    .about-image {
        width: 100%;
    }
    
    .video-player {
        height: 250px;
    }
    
    .slider-container {
        height: 350px;
    }
    
    .slide-content h2 {
        font-size: 1.8rem;
    }
    
    .slide-content p {
        font-size: 1rem;
    }

    .logo-text {
        font-size: 20px;
    }
    
    .popup-text:hover span {
        animation-duration: 0.4s;
    }

    footer {
        padding: 40px 15px 15px;
    }
    
    .footer-content {
        gap: 30px;
        flex-direction: column;
        align-items: center;
        padding: 0 15px;
        margin: 0 auto 30px;
    }
    
    .footer-column {
        min-width: 100%;
        max-width: 400px;
    }
    
    .footer-section {
        padding: 20px 15px;
    }
    
    .contact-item {
        justify-content: center;
        text-align: center;
    }
    
    .contact-item span {
        max-width: none;
    }
    
    .copyright {
        padding: 20px 15px 0 15px;
    }

    .about-content.split-layout {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .about-text {
        padding-right: 0;
    }
    
    .about-image {
        position: relative;
        top: 0;
    }
    
    .image-container {
        aspect-ratio: 3/4;
        max-width: 400px;
        margin: 0 auto 25px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .professional-gallery {
        grid-template-columns: 1fr;
        max-width: 400px;
        margin: 0 auto;
    }
}

@media (max-width: 480px) {
    .service-item {
        padding: 25px 15px;
    }
    
    .service-icon {
        width: 70px;
        height: 70px;
        font-size: 1.8rem;
        margin-bottom: 20px;
    }
    
    .service-item h3 {
        font-size: 1.3rem;
    }
    
    .service-item p {
        font-size: 0.95rem;
    }

    footer {
        padding: 30px 10px 10px;
    }
    
    .footer-content {
        gap: 25px;
        padding: 0 10px;
        margin: 0 auto 25px;
    }
    
    .footer-section {
        padding: 15px 12px;
    }
    
    .social-icons {
        gap: 8px;
    }
    
    .social-icons a {
        width: 36px;
        height: 36px;
    }
    
    .copyright {
        padding: 15px 10px 0 10px;
    }
    
    .footer-column h3 {
        font-size: 1.2rem;
    }
    
    .footer-center p {
        font-size: 1rem;
    }

    .about-content.split-layout {
        gap: 30px;
    }
    
    .institute-stats-left {
        padding: 25px 20px;
    }
    
    .stat-item {
        padding: 15px;
    }
    
    .stat-item i {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .image-container {
        aspect-ratio: 2/3;
        max-width: 350px;
    }

    .institute-stats-left {
        padding: 20px 15px;
    }
    
    .expertise-tags {
        justify-content: center;
    }
    
    .image-container {
        aspect-ratio: 3/4;
        max-width: 300px;
    }
    
    .gallery-item {
        aspect-ratio: 4/3;
    }
}

/* Extra Small Devices */
@media (max-width: 360px) {
    .footer-content {
        padding: 0 8px;
    }
    
    .footer-section {
        padding: 12px 10px;
    }
    
    .social-icons {
        gap: 6px;
    }
    
    .social-icons a {
        width: 34px;
        height: 34px;
    }
    
    .contact-item {
        gap: 8px;
    }
    
    .contact-item span {
        font-size: 0.9rem;
    }
}

@media (max-width: 1200px) {
    .image-container {
        aspect-ratio: 2/3;
    }
}

/* Print styles for images */
@media print {
    .profile-photo,
    .gallery-item img {
        max-width: 300px;
        height: auto;
    }
}

/* Hamburger Menu Styles */
.hamburger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 25px;
    cursor: pointer;
    position: relative;
    z-index: 1000;
    padding: 5px;
    margin-left: auto;
}

.hamburger-menu span {
    display: block;
    height: 3px;
    width: 100%;
    background-color: var(--dark);
    border-radius: 3px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

/* Hamburger Menu Animation */
.hamburger-menu.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
    background-color: var(--dark);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
    transform: scale(0);
}

.hamburger-menu.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
    background-color: var(--dark);
}

/* Main Navigation - Visible on desktop, hidden on mobile */
.main-nav {
    margin-top: 20px;
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-nav a {
    text-decoration: none;
    color: var(--dark);
    font-weight: 600;
    padding: 10px 15px;
    border-radius: 30px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.main-nav a:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--primary);
    z-index: -1;
    transition: var(--transition);
    border-radius: 30px;
}

.main-nav a:hover {
    color: white;
    transform: translateY(-5px);
}

.main-nav a:hover:before {
    left: 0;
}

/* Mobile Styles */
@media (max-width: 768px) {
    /* Show hamburger menu on mobile */
    .hamburger-menu {
        display: flex;
    }
    
    /* Hide main navigation by default on mobile */
    .main-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: linear-gradient(135deg, rgba(255,255,255,0.98) 0%, rgba(248,249,250,0.99) 100%);
        backdrop-filter: blur(20px);
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding: 80px 20px 40px;
        margin-top: 0;
        gap: 0;
        box-shadow: -5px 0 30px rgba(0,0,0,0.15);
        z-index: 999;
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex !important; /* Ensure it's flex when active */
    }
    
    /* Show navigation when hamburger is active */
    .main-nav.active {
        right: 0;
    }
    
    /* Style mobile menu items */
    .main-nav a {
        width: 100%;
        text-align: center;
        padding: 18px 20px;
        margin: 8px 0;
        border-radius: 15px;
        font-size: 1.1rem;
        transform: translateX(30px);
        opacity: 0;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        border: 1px solid rgba(74, 111, 165, 0.1);
        background: rgba(255, 255, 255, 0.8);
        color: var(--dark);
    }
    
    .main-nav.active a {
        transform: translateX(0);
        opacity: 1;
    }
    
    /* Staggered animation for menu items */
    .main-nav.active a:nth-child(1) { transition-delay: 0.1s; }
    .main-nav.active a:nth-child(2) { transition-delay: 0.15s; }
    .main-nav.active a:nth-child(3) { transition-delay: 0.2s; }
    .main-nav.active a:nth-child(4) { transition-delay: 0.25s; }
    .main-nav.active a:nth-child(5) { transition-delay: 0.3s; }
    .main-nav.active a:nth-child(6) { transition-delay: 0.35s; }
    .main-nav.active a:nth-child(7) { transition-delay: 0.4s; }
    
    /* Mobile touch effects */
    .main-nav a:active {
        background: var(--primary);
        color: white;
        transform: scale(0.95);
    }
    
    /* Overlay when menu is open */
    .nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        backdrop-filter: blur(5px);
        z-index: 998;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .nav-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* Adjust header layout for mobile */
    header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        position: relative;
    }
    
    .logo-container {
        flex: 1;
        min-width: 0;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .main-nav {
        width: 85%;
        max-width: 280px;
        padding: 70px 15px 30px;
    }
    
    .main-nav a {
        padding: 16px 15px;
        font-size: 1rem;
        margin: 6px 0;
    }
    
    .hamburger-menu {
        width: 28px;
        height: 23px;
    }
}

/* Extra small devices */
@media (max-width: 360px) {
    .main-nav {
        width: 90%;
        max-width: 260px;
        padding: 60px 10px 20px;
    }
    
    .main-nav a {
        padding: 14px 12px;
        font-size: 0.95rem;
    }
}