.logo-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 150px;
}

.animation-container {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 1;
    transition: opacity 1s ease-in-out;
}

.horizon-line {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translateX(-50%);
    height: 4px; /* Increased from 2px */
    background-color: #2f3591;
    animation: expandLine 1s ease-out forwards;
    z-index: 2;
}

.sun-clip {
    position: absolute;
    top: -80px; /* Reduced from -90px */
    left: 0;
    width: 100%;
    height: calc(50% + 80px); /* Adjusted to match new top value */
    overflow: hidden;
}

.rising-sun {
    position: absolute;
    left: 50%;
    bottom: -110px; /* Increased from -90px to show less of circle */
    transform: translateX(-50%) translateY(100%);
    width: 180px;
    height: 180px; /* Made perfectly circular */
    border: 3.5px solid #2f3591; /* Increased from 3px, still slightly thinner than horizon's 4px */
    border-radius: 50%;
    background: none;
    animation: riseSun 1.5s ease-out 1s forwards;
    opacity: 0;
}

.actual-logo {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: all 1s ease-in-out;
}

.logo-container.animation-complete {
    top: 20px;
    left: 20px;
    transform: none;
    transition: all 1s ease-in-out;
    z-index: 4; /* Ensures logo is above the nav bar */
}

.logo-container.animation-complete .animation-container {
    opacity: 0;
}

.logo-container.animation-complete .actual-logo {
    opacity: 1;
}

@keyframes expandLine {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes riseSun {
    0% {
        transform: translateX(-50%) translateY(100%);
        opacity: 0;
    }
    100% {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Navigation Links Styling */
nav.nav-links {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 150px;
    display: flex;
    align-items: center;
    padding: 0 20px 0 340px; /* 340px left padding (logo width 300px + 20px left margin + 20px spacing) */
    box-sizing: border-box;
    font-size: 2em;
    z-index: 3;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

nav.nav-links a {
    flex: 1;
    text-align: center;
    color: #2f3591;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    transform: translateY(17.5px);
    position: relative;
    padding: 5px 0;
    display: inline-block; /* This ensures the underline only spans the text width */
}

nav.nav-links a:hover {
    color: #2f3591;
    transform: translateY(17.5px) scale(1.05);
}

/* Underline animation for nav links */
nav.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 50%;
    background-color: #2f3591;
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    transform: translateX(-50%);
    max-width: 60px; /* Increased from 40px to 60px */
}

nav.nav-links a:hover::after {
    width: 60px; /* Match the new max-width */
}

nav.nav-links a.active {
    color: #2f3591;
    font-weight: 500;
}

nav.nav-links a.active::after {
    width: 60px;
}

/* Main content styling */
main {
    margin-top: 150px;
    padding-bottom: 50px; /* Extra space so content doesn't hide behind the fixed footer */
}

.section {
    padding: 60px 20px;
    opacity: 0;
    transform: translateY(30px);
    transition: all 1.2s cubic-bezier(0.22, 1, 0.36, 1);
    scroll-margin-top: 170px; /* Desktop offset */
    position: relative;
    overflow: hidden;
}

.section-visible {
    opacity: 1;
    transform: translateY(0);
}

.section:nth-of-type(even) {
    background-color: #f7f7f7;
}

.section .container {
    max-width: 1000px;
    margin: 0 auto;
    text-align: center;
}

.section h2 {
    color: #2f3591;
    font-size: 2.5em;
    margin-bottom: 20px;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.22, 1, 0.36, 1);
    transition-delay: 0.2s;
}

.section-visible h2 {
    transform: translateY(0);
    opacity: 1;
}

.section p {
    font-size: 1.125em;
    line-height: 1.6;
    color: #555;
    margin: 0 auto;
    max-width: 800px;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.22, 1, 0.36, 1);
    transition-delay: 0.4s;
}

.section-visible p {
    transform: translateY(0);
    opacity: 1;
}

/* Pseudo-element to add extra visual space below the nav */
nav.nav-links::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -20px; /* Extend background 20px lower */
    height: 20px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 2; /* Positioned behind the actual nav links */
}

.footer-container {
    text-align: center;
    padding: 20px 0;
    background-color: #fff;
    font-size: 0.9em;
    color: #555;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
    position: relative; /* For absolute positioning of the switch */
}

.footer-container a {
    color: #2f3591;
    text-decoration: none;
}

.footer-container a:hover {
    text-decoration: underline;
}

.heart {
    color: red;
}

/* Footer Sticky Styling */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 4; /* Ensure the footer is above content but below the logo if needed */
}

/* Services Grid */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.service-item {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
    overflow: hidden;
}

.service-item:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.service-item h3 {
    color: #2f3591;
    font-size: 1.5em;
    margin-bottom: 15px;
}

/* Contact Form */
.contact-form {
    max-width: 600px;
    margin: 40px auto 100px; /* Increased bottom margin to 100px */
}

.form-group {
    position: relative;
    margin-bottom: 30px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 0;
    font-size: 1rem;
    border: none;
    border-bottom: 2px solid #ddd;
    outline: none;
    background: transparent;
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.form-group label {
    position: absolute;
    top: 10px;
    left: 0;
    font-size: 1rem;
    color: #999;
    pointer-events: none;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    border-bottom-color: #2f3591;
    transform: translateX(5px);
}

.form-group input:focus ~ label,
.form-group textarea:focus ~ label,
.form-group input:valid ~ label,
.form-group textarea:valid ~ label {
    top: -20px;
    font-size: 0.8rem;
    color: #2f3591;
}

.form-group textarea {
    min-height: 100px;
    max-height: 200px;
    resize: vertical;
    overflow-y: auto;
    transition: none;
}

/* Separate transitions for focus effects only */
.form-group textarea:focus {
    transition: border-color 0.3s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Add a scrollbar when content exceeds max height */
.form-group textarea::-webkit-scrollbar {
    width: 8px;
    background-color: transparent;
}

.form-group textarea::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
    margin: 5px;
}

.form-group textarea::-webkit-scrollbar-thumb {
    background: #2f3591;
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.form-group textarea::-webkit-scrollbar-thumb:hover {
    background: #252a73;
    background-clip: padding-box;
}

/* Dark mode scrollbar */
[data-theme="dark"] .form-group textarea::-webkit-scrollbar-track {
    background: #333;
}

[data-theme="dark"] .form-group textarea::-webkit-scrollbar-thumb {
    background: #2f3591;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.submit-btn {
    background: #2f3591;
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
    overflow: hidden;
}

.submit-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150%;
    height: 150%;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.5s ease;
}

.submit-btn:hover::after {
    transform: translate(-50%, -50%) scale(1);
}

/* Logo link styling */
.logo-link {
    text-decoration: none;
    cursor: pointer;
}

.logo-link:focus {
    outline: none;
}

/* Theme Switch Styling */
.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    padding: 0 20px;
}

/* Center the copyright text */
.footer-content p {
    text-align: center;
    margin: 0;
}

/* Position the theme switch on the far right */
.theme-switch-wrapper {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    margin-right: 20px; /* Add some margin from the edge */
}

.theme-switch {
    display: inline-block;
    height: 34px;
    position: relative;
    width: 60px;
}

.theme-switch input {
    display: none;
}

.slider {
    background-color: #ccc;
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
    border-radius: 34px;
}

.slider .sun,
.slider .moon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    transition: .4s;
    font-size: 16px;
}

.slider .sun {
    right: 5px;
}

.slider .moon {
    left: 5px;
    opacity: 0;
}

.slider:before {
    background-color: #fff;
    bottom: 4px;
    content: "";
    height: 26px;
    left: 4px;
    position: absolute;
    transition: .4s;
    width: 26px;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #2f3591;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

input:checked + .slider .sun {
    opacity: 0;
}

input:checked + .slider .moon {
    opacity: 1;
}

/* Dark mode styles */
[data-theme="dark"] {
    background-color: #1a1a1a;
    color: #fff;
}

[data-theme="dark"] nav.nav-links,
[data-theme="dark"] nav.nav-links::after,
[data-theme="dark"] .footer-container {
    background-color: #2a2a2a;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .service-item {
    background-color: #2a2a2a;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .section:nth-of-type(even) {
    background-color: #222;
}

[data-theme="dark"] .section p {
    color: #ddd;
}

[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group textarea {
    color: #fff;
    border-bottom-color: #444;
}

[data-theme="dark"] .form-group label {
    color: #888;
}

/* Subtle background gradient animation */
@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

body {
    background: linear-gradient(45deg, #f9f9f9, #ffffff, #f5f5f5);
    background-size: 200% 200%;
    animation: gradientBG 15s ease infinite;
}

[data-theme="dark"] body {
    background: linear-gradient(45deg, #1a1a1a, #222222, #1f1f1f);
    background-size: 200% 200%;
    animation: gradientBG 15s ease infinite;
}

/* Subtle section background effect */
.section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), 
                rgba(47, 53, 145, 0.03), transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.section:hover::before {
    opacity: 1;
}

/* Scroll-to-top button styles */
.scroll-to-top {
    position: fixed;
    bottom: 100px; /* Raised to avoid overlap with footer theme switch */
    right: 20px;
    background: #2f3591;
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 24px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 100;
}

.scroll-to-top.show {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top:hover {
    background: #252a73;
    transform: translateY(-2px);
}

/* Hamburger menu styles */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    position: absolute;
    right: 20px;
    top: 65px;
    z-index: 10;
}

.hamburger span {
    width: 100%;
    height: 3px;
    background: #2f3591;
    border-radius: 10px;
    transition: all 0.3s linear;
    position: relative;
    transform-origin: center;
}

/* Mobile navigation styles */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
        top: 75px;
    }

    nav.nav-links {
        padding: 0;
        justify-content: center;
    }

    nav.nav-links a {
        display: block;
        opacity: 0;
        pointer-events: none;
        width: 100%;
        text-align: center;
        padding: 12px 0;
        transform: none;
        font-size: 0.6em;
        transition: opacity 0.3s ease;
    }

    nav.nav-links.open {
        padding: 180px 0 20px;
        background: rgba(255, 255, 255, 0.98);
    }

    nav.nav-links.open a {
        opacity: 1;
        pointer-events: auto;
        animation: slideIn 0.3s ease-out forwards;
    }

    nav.nav-links.open .hamburger span:first-child {
        transform: translateY(11px) rotate(45deg);
    }

    nav.nav-links.open .hamburger span:nth-child(2) {
        opacity: 0;
    }

    nav.nav-links.open .hamburger span:last-child {
        transform: translateY(-11px) rotate(-45deg);
    }

    .section {
        scroll-margin-top: 220px; /* Increased offset for mobile nav bar height */
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dark mode mobile nav */
[data-theme="dark"] .hamburger span {
    background: #fff;
}

[data-theme="dark"] nav.nav-links.open {
    background: rgba(42, 42, 42, 0.98);
}
