/* Project Cards Refinement */
/* Consolidated Project Card styles moved to line 750 for organization */

.project-card.elite {
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.08),
        inset 0 0 20px rgba(var(--primary-rgb), 0.05);
    border: 1px solid rgba(var(--primary-rgb), 0.15);
    /* Removed redundant transition definition to respect base class optimization */
}

.project-card.elite:hover {
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.12),
        0 0 30px rgba(var(--primary-rgb), 0.1);
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 25px;
    width: 100%;
}

.project-tech span {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 4px;
    color: var(--text-soft);
    border: 1px solid rgba(0, 0, 0, 0.02);
}

/* High-Intent CTA Variant */
.btn.btn-primary,
#hero-cta,
.btn.contact-nav-btn {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border-color: var(--btn-primary-border);
    box-shadow: var(--btn-primary-shadow);
    font-weight: 700;
}

#hero-cta {
    margin-bottom: 4px;
}

.hero-action-row {
    width: auto;
    max-width: none;
    display: block;
    margin: 0 auto;
}

#hero-intro-content:not(.show-about):not(.show-client):not(.show-projects):not(.show-services) .hero-action-row {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: center;
    align-items: center;
}

#hero-intro-content:not(.show-about):not(.show-client):not(.show-projects):not(.show-services) #hero-cta {
    display: block;
    order: 1;
    margin: 0 auto 4px;
}

#hero-intro-content:not(.show-about):not(.show-client):not(.show-projects):not(.show-services) .hero-skip-cta {
    display: block;
    order: 2;
    margin: 18px auto 0;
}

.btn.btn-primary:hover,
#hero-cta:hover,
.btn.contact-nav-btn:hover {
    color: var(--btn-primary-text);
    transform: none;
    box-shadow: var(--btn-primary-shadow-hover);
    filter: none;
}

.btn.btn-primary:active,
#hero-cta:active,
.btn.contact-nav-btn:active {
    transform: none;
    box-shadow: var(--btn-primary-shadow-active);
}

#hero-cta.locked-until-third {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
    pointer-events: none;
}

.hero-skip-cta {
    margin-top: 18px;
}

.btn.hero-switch-cta {
    display: none;
    margin-top: 0;
    opacity: 0;
    max-height: 0;
    max-width: 0;
    padding-inline: 0;
    border-width: 0;
    letter-spacing: 0;
    transform: translateY(-12px);
    pointer-events: none;
    overflow: hidden;
}

#hero-intro-content.show-about.about-switch-ready #about-switch-cta {
    display: inline-block;
    opacity: 1;
    max-height: 84px;
    max-width: 360px;
    padding-inline: 36px;
    border-width: 1px;
    letter-spacing: 2px;
    margin-top: 0;
    transform: translateY(0);
    pointer-events: auto;
}

#hero-intro-content.show-client.client-switch-ready #client-switch-cta {
    display: inline-block;
    opacity: 1;
    max-height: 84px;
    max-width: 360px;
    padding-inline: 36px;
    border-width: 1px;
    letter-spacing: 2px;
    margin-top: 0;
    transform: translateY(0);
    pointer-events: auto;
}

#hero-intro-content.path-choice-open .hero-skip-cta,
#hero-intro-content.show-about .hero-skip-cta,
#hero-intro-content.show-client .hero-skip-cta,
#hero-intro-content.show-projects .hero-skip-cta,
#hero-intro-content.show-services .hero-skip-cta {
    opacity: 0;
    max-height: 0;
    margin: 0;
    transform: translateY(-16px);
    pointer-events: none;
}

#hero-intro-content.path-choice-open .hero-switch-cta,
#hero-intro-content.show-about #client-switch-cta,
#hero-intro-content.show-client #about-switch-cta,
#hero-intro-content.show-projects .hero-switch-cta,
#hero-intro-content.show-services .hero-switch-cta,
#hero-intro-content.returning-home .hero-switch-cta {
    display: none;
    opacity: 0;
    max-height: 0;
    max-width: 0;
    padding-inline: 0;
    border-width: 0;
    letter-spacing: 0;
    margin: 0;
    transform: translateY(-16px);
    pointer-events: none;
}

/* Bio-Orb Floating Contact Anchor */
.bio-orb {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--accent-organic);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-deep);
    text-decoration: none;
    box-shadow: 0 10px 40px rgba(var(--primary-rgb), 0.35);
    z-index: 1000;
    transition: all 0.6s cubic-bezier(0.19, 1, 0.22, 1);
    border: 3px solid rgba(255, 255, 255, 0.4);
}

.bio-orb:hover {
    transform: scale(1.15) rotate(15deg);
    box-shadow: 0 20px 50px rgba(var(--primary-rgb), 0.55);
    background: var(--hover-active);
    color: var(--hover-text);
}

.bio-orb svg {
    width: 28px;
    height: 28px;
    transition: transform 0.6s cubic-bezier(0.19, 1, 0.22, 1);
}

.bio-orb:hover svg {
    transform: scale(1.2);
}

.project-card .btn {
    margin-top: auto;
}

/* Floating Hero */
header {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 20px 60px 20px;
    /* Reduced from 100px to lift content slightly */
}

.container {
    max-width: 1300px;
    margin: 0 auto;
    width: 100%;
    position: relative;
}

header .container {
    display: grid;
    place-items: center;
}

header h1 {
    font-size: 4.5rem;
    /* Reduced from 6rem */
    font-weight: 900;
    margin-bottom: 20px;
    letter-spacing: -3px;
    background: linear-gradient(135deg, var(--text-deep), var(--primary-ethereal));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 10px 10px rgba(0, 0, 0, 0.05));
    text-align: center;
    transition: opacity 1.5s cubic-bezier(0.23, 1, 0.32, 1), transform 1.5s cubic-bezier(0.23, 1, 0.32, 1);
}

/* Explicitly target H1 inside the container for transition matching */
.hero-text-wrapper {
    max-height: 300px;
    opacity: 1;
    transform: translateY(0);
    margin-bottom: 0;
    overflow: hidden;
    /* Transition handles the collapse direction; restoreHeroText animation handles restore */
    transition: max-height 0.7s cubic-bezier(0.23, 1, 0.32, 1),
                opacity 0.5s cubic-bezier(0.23, 1, 0.32, 1),
                transform 0.7s cubic-bezier(0.23, 1, 0.32, 1),
                margin-bottom 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

@keyframes restoreHeroText {
    0%, 30% {
        max-height: 0;
        opacity: 0;
        margin-bottom: -20px;
        transform: translateY(-30px) scale(0.96);
    }

    100% {
        max-height: 300px;
        opacity: 1;
        margin-bottom: 0;
        transform: translateY(0) scale(1);
    }
}

/* Base state with high specificity to ensure animation handoff */
#hero-intro-content h1,
#hero-intro-content .hero-tagline {
    opacity: 1;
    transform: translateY(0) scale(1);
    transition: opacity 1.2s cubic-bezier(0.19, 1, 0.22, 1), transform 1.2s cubic-bezier(0.19, 1, 0.22, 1);
}

#hero-intro-content .hero-tagline {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: min(700px, calc(100vw - 36px));
    max-width: calc(100vw - 36px);
    --wave-pos: -20%;
    --wave-opacity: 0;
}

#hero-intro-content .hero-tagline::after {
    content: none;
}

.hero-karaoke-line {
    display: inline-block;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    position: relative;
    color: inherit;
    overflow-wrap: anywhere;
    --wave-pos: -20%;
    --wave-opacity: 0;
}

.hero-karaoke-line::after {
    content: attr(data-karaoke);
    position: absolute;
    inset: 0;
    color: transparent;
    background: linear-gradient(
        90deg,
        rgba(0, 0, 0, 0) calc(var(--wave-pos) - 16%),
        rgba(31, 108, 84, 0.28) calc(var(--wave-pos) - 11%),
        rgba(31, 108, 84, 0.72) calc(var(--wave-pos) - 5%),
        #6ff2d7 var(--wave-pos),
        rgba(31, 108, 84, 0.82) calc(var(--wave-pos) + 5%),
        rgba(31, 108, 84, 0.34) calc(var(--wave-pos) + 11%),
        rgba(0, 0, 0, 0) calc(var(--wave-pos) + 16%)
    );
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: var(--wave-opacity);
    pointer-events: none;
    will-change: opacity;
}

#hero-intro-content .hero-tagline.hero-wave-active {
    color: var(--text-deep);
}

#hero-intro-content .hero-tagline.hero-wave-complete {
    color: var(--text-deep);
}

.hero-karaoke-line.is-active,
.hero-karaoke-line.is-complete {
    color: var(--text-deep);
}

/* Apply sequencing animation ONLY when returning to Home explicitly */
#hero-intro-content.returning-home .hero-text-wrapper {
    animation: restoreHeroText 1.2s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

#hero-intro-content.show-about .hero-text-wrapper,
#hero-intro-content.show-client .hero-text-wrapper,
#hero-intro-content.show-projects .hero-text-wrapper,
#hero-intro-content.show-services .hero-text-wrapper {
    max-height: 0;
    opacity: 0;
    margin-bottom: -20px;
    transform: translateY(-30px) scale(0.96);
    pointer-events: none;
    /* CSS transition (defined on .hero-text-wrapper) handles the smooth collapse */
}

header p {
    font-size: 1.3rem;
    /* Slightly smaller */
    color: var(--text-soft);
    max-width: 700px;
    margin: 0 auto 30px;
    /* Reduced margin */
    font-weight: 300;
    text-align: center;
    transition: all 1s cubic-bezier(0.23, 1, 0.32, 1) 0.1s;
    /* Slight delay for subtitle */
}

body.hero-compact-mode header {
    align-items: flex-start;
    min-height: 100svh;
    padding-top: clamp(150px, 28svh, 220px);
    padding-bottom: 32px;
}

body.hero-compact-mode .hero-text-wrapper {
    max-height: 240px;
}

body.hero-compact-mode header h1 {
    font-size: clamp(2.8rem, 7vw, 3.65rem);
    letter-spacing: -1.5px;
    margin-bottom: 10px;
    line-height: 1;
}

body.hero-compact-mode header p {
    font-size: clamp(0.95rem, 1.8vw, 1.08rem);
    line-height: 1.42;
    margin-bottom: 20px;
}

body.hero-compact-mode #hero-intro-content .hero-tagline {
    width: min(440px, calc(100vw - 36px));
    gap: 3px;
}

body.hero-compact-mode #hero-intro-content:not(.show-about):not(.show-client):not(.show-projects):not(.show-services) #hero-cta {
    margin-bottom: 0;
}
