/* Typewriter Effect for Hero Name */

#hero {
    position: relative;
}

.typed-name {
    display: inline-block;
    position: relative;
    font-size: 4.5em;
    margin: 0 0 15px 0;
    line-height: 1.1;
    font-family: 'Cormorant Garamond', serif;
}

/* Typing cursor effect - inline with text */
.typed-name.typing {
    position: relative;
}

.typed-name.typing::after {
    content: '|';
    color: #e87a5d;
    font-weight: 300;
    animation: blink 0.7s step-end infinite;
    margin-left: 2px;
}

@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

/* Underline wrapper */
.underline-wrapper {
    display: inline-block;
    position: relative;
    width: 100%;
}

/* Animated underline that appears AFTER typing completes */
.underline-wrapper::before {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 4px;
    background: linear-gradient(90deg, #e87a5d, #d86b4e);
    border-radius: 2px;
    box-shadow: 0 2px 8px rgba(232, 122, 93, 0.4);
    opacity: 0;
    transition: none;
}

/* Show and animate underline only after typing is complete */
.underline-wrapper.show-underline::before {
    animation: drawUnderline 2s ease-out forwards;
}

/* Underline drawing animation */
@keyframes drawUnderline {
    0% {
        width: 0;
        opacity: 1;
    }
    60% {
        width: 80%;
        opacity: 1;
    }
    100% {
        width: 80%;
        opacity: 0;
    }
}

/* Subtitle initially hidden */
#hero #subtitle {
    display: block;
    visibility: visible;
}

#hero #subtitle.subtitle-hidden {
    opacity: 0;
    transform: translateY(-40px);
    animation: none;
}

/* Subtitle shown after typing - slides down from top with animation */
#hero #subtitle.subtitle-visible {
    animation: slideDownSubtitle 1.2s cubic-bezier(0.4, 0.0, 0.2, 1) forwards;
}

@keyframes slideDownSubtitle {
    0% {
        opacity: 0;
        transform: translateY(-40px);
        filter: blur(3px);
    }
    100% {
        opacity: 0.9;
        transform: translateY(0);
        filter: blur(0);
    }
}

/* Mobile responsive */
@media (max-width: 480px) {
    .typed-name {
        font-size: 2.5em;
    }
    
    .underline-wrapper::before {
        height: 3px;
        bottom: -8px;
    }
    
    #hero #subtitle.subtitle-hidden {
        transform: translateY(-30px) !important;
    }
}

@media (max-width: 768px) {
    .typed-name {
        font-size: 3em;
    }
    
    /* Prevent outline cutoff on mobile */
    .underline-wrapper {
        padding: 2px 0; /* Add padding to prevent border cutoff */
        overflow: visible;
    }
    
    #hero h1 {
        overflow: visible;
    }
}

/* Ensure subtitle respects transition */
#hero h2 {
    will-change: transform, opacity;
    backface-visibility: hidden;
}
