/* styles.css */

/* Custom CSS for the animation */
.animation-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.animation-text {
    display: inline-flex;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    transition: letter-spacing 2s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    white-space: nowrap;
}

.animation-text .letter {
    display: inline-block;
    transition:
            opacity 2s cubic-bezier(0.4, 0, 0.2, 1),
            width 2s cubic-bezier(0.4, 0, 0.2, 1),
            margin 2s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity, width, margin;
    margin-right: 0.05em;
    width: 0.8em; /* Set a fixed width */
}

.animation-text .letter.unused {
    color: #9ca3af;
    opacity: 1;
    pointer-events: none;
    transition:
            opacity 2s cubic-bezier(0.4, 0, 0.2, 1),
            width 2s cubic-bezier(0.4, 0, 0.2, 1),
            margin 2s cubic-bezier(0.4, 0, 0.2, 1);
}
.animation-text.contract .letter.unused {
    opacity: 0;
    width: 0;
    margin-right: 0;
}

.animation-text .letter.hidden {
    opacity: 0 !important;
    width: 0 !important;
    margin-right: 0 !important;
    pointer-events: none;
}

.animation-text.contract .letter.unused.hidden {
    visibility: hidden; /* Apply after width transition */
}

.animation-text.contract:hover .letter.unused {
    opacity: 1 !important;
    width: 0.8em !important; /* Restore fixed width */
    visibility: visible !important;
}



/* Ensure smooth transition for background and text colors */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 84px; /* Set this to your navbar height */
}
body {
    margin: 0;
    padding: 0;
    scroll-snap-type: y mandatory;
    overflow-y: auto;
    #height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

nav {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000; /* Ensures nav stays above other content */
    background: #fff;
}

nav a, button, textarea {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

main {
    scroll-snap-type: y mandatory;
    overflow-y: auto;
    height: 100vh;
}

section {
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: start;
}

/* Message box transitions */
#message-box {
    transition: opacity 0.3s;
    opacity: 1;
    z-index: 1000;
}
#message-box.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Optional: Smooth textarea focus ring for accessibility */
textarea:focus {
    outline: none;
    box-shadow: 0 0 0 2px #6366f1;
}

h2 {
    font-family: 'Merriweather', serif;
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

footer {
    background: #1a202c; /* dark gray */
    border-top: 1px solid #374151;
    color: #e5e7eb;
}

/* Small screen nav menu styles */
#nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
    padding: 1rem;
    display: flex; /* Always flex for layout */
    flex-direction: column;
    gap: 0.5rem;
    opacity: 0;
    pointer-events: auto; /* Prevent interaction when hidden */
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
}

#nav-links.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

#nav-links a {
    padding: 0.75rem 1rem; /* Spacing inside links */
    border-radius: 0.375rem; /* Rounded corners for links */
    background-color: transparent; /* Default background */
    color: #111827; /* Default text color */
    text-align: center; /* Center align text */
    font-weight: 500; /* Medium font weight */
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow: hidden;
}

#nav-links a:hover {
    background-color: #f3f4f6 !important; /* Light hover background */
    color: #4F46E5 !important; /* Primary hover color */
}

/* Dark mode styles */
.dark #nav-links {
    background-color: #374151; /* Dark background */
    border-color: #374151;     /* Dark border */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5); /* Stronger shadow */
    color: #f9fafb;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.dark #nav-links a {
    color: #f9fafb; /* Light text color */
}

.dark #nav-links a:hover {
    background-color: #4b5563 !important; /* Dark hover background */
    color: #6366F1 !important; /* Primary hover color (dark mode) */
}

/* Corrected small screen nav menu styles */
@media (max-width: 640px) {
    #nav-links {
        display: flex; /* Always flex for layout */
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: #ffffff;
        border: 1px solid #e5e7eb;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        border-radius: 0.5rem;
        padding: 1rem;
        gap: 0.5rem;
        opacity: 0; /* Hidden by default */
        pointer-events: none; /* Not interactive when hidden */
        transform: translateY(-10px);
        transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
        overflow: hidden;
        visibility: hidden;
    }

    #nav-links.show {
        opacity: 1; /* Show when active */
        pointer-events: auto;
        transform: translateY(0);
        visibility: visible;
    }

    .dark #nav-links {
        background-color: #374151;
        border-color: #374151;
        color: #f9fafb;
        transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.3s ease, color 0.3s ease;
    }
    .dark #nav-links a {
        color: #f9fafb;
    }
}

@media (min-width: 640px) {
    #nav-links {
        display: flex !important;
        position: static;
        flex-direction: row;
        opacity: 1;
        transform: none;
        width: auto;
        background-color: transparent;
        border: none;
        box-shadow: none;
        padding: 0;
        gap: 1rem;
    }
    .dark #nav-links {
        background-color: transparent; /* Dark background */
        border-color: transparent;     /* Dark border */
        box-shadow: none;
    }
}