:root {
    --social-icon-touch-size: 44px;
    --social-icon-padding: 8px;
    --social-icon-padding-tablet: 10px;
    --social-icon-padding-mobile: 11px;

    /* Safe area inset for mobile browser UI */
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);

    /* Extra padding for mobile to accommodate browser UI elements (e.g., navigation bar) */
    --mobile-extra-padding: 20px;

    --padding-bottom-safe: calc(1rem + var(--safe-area-inset-bottom));
    --padding-bottom-safe-tablet: calc(0.75rem + var(--safe-area-inset-bottom));
    --padding-bottom-safe-mobile: calc(0.5rem + var(--safe-area-inset-bottom) + var(--mobile-extra-padding));
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', 'Helvetica', sans-serif;
    background: #000000;
    color: #e0e0e0;
    line-height: 1.6;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: manipulation;
}

/* Hero Section */
.hero-section {
    position: relative;
    width: 100%;
    /* Fallback for browsers that don't support dvh */
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    overflow: hidden;
    padding-bottom: var(--safe-area-inset-bottom);
}

/* Use dynamic viewport height for modern browsers that support it */
@supports (height: 100dvh) {
    .hero-section {
        height: 100dvh;
    }
}

/* Fallback for older Safari iOS versions that don't support dvh */
@supports not (height: 100dvh) {
    .hero-section {
        min-height: -webkit-fill-available;
    }
}

.hero-background {
    position: absolute;
    top: -5%;
    left: -5%;
    width: 110%;
    height: 110%;
    z-index: -1;
    background-image: url('../gallery/engineer.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: transform 0.1s ease-out;
    will-change: transform;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.8) 100%);
}

/* Top Navigation */
.top-nav {
    position: relative;
    display: flex;
    gap: 3rem;
    padding: 2rem 0 1rem 0;
    opacity: 0;
    animation: fadeIn 1.5s ease-out 0.2s forwards;
}

.nav-item {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    cursor: default;
    transition: color 0.4s ease;
}

.nav-item:hover {
    color: rgba(255, 255, 255, 0.9);
}

/* Logo Container */
.hero-logo-container {
    position: relative;
    text-align: center;
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 1rem 0 1rem 0;
    opacity: 0;
    animation: fadeIn 2s ease-out 0.5s forwards;
}

.hero-logo {
    max-width: 520px;
    width: 78vw;
    height: auto;
    display: block;
}

/* Fade In Animation */
@keyframes fadeIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Video Container */
.hero-video-container {
    position: relative;
    width: 90%;
    max-width: 800px;
    aspect-ratio: 16 / 9;
    margin: auto auto 2rem auto;
    opacity: 0;
    animation: fadeIn 2s ease-out 0.6s forwards;
    overflow: hidden;
    border-radius: 8px;
    -webkit-overflow-scrolling: touch;
}

.hero-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
}

/* Social Icons */
.hero-social {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    padding: 0 2rem;
    padding-bottom: var(--padding-bottom-safe);
    opacity: 0;
    animation: fadeIn 2s ease-out 0.8s forwards;
}

.social-icon {
    color: rgba(255, 255, 255, 0.4);
    text-decoration: none;
    transition: all 0.4s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: var(--social-icon-touch-size);
    min-height: var(--social-icon-touch-size);
    padding: var(--social-icon-padding);
    -webkit-tap-highlight-color: transparent;
}

.social-icon svg {
    width: 28px;
    height: 28px;
}

.social-icon:hover {
    color: rgba(255, 255, 255, 1);
    transform: translateY(-3px);
}

/* Footer */
.hero-footer {
    position: relative;
    text-align: center;
    padding: 1rem 0;
    padding-bottom: var(--padding-bottom-safe);
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.75rem;
    width: 100%;
    opacity: 0;
    animation: fadeIn 2s ease-out 1.2s forwards;
}

.hero-footer p {
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .top-nav {
        gap: 2rem;
        padding: 1.5rem 0 0.5rem 0;
    }

    .nav-item {
        font-size: 0.8rem;
    }

    .hero-logo-container {
        padding-top: 1rem;
    }

    .hero-logo {
        max-width: 280px;
        width: 55vw;
    }

    .hero-social {
        gap: 1.5rem;
        padding: 0 1rem;
        padding-bottom: var(--padding-bottom-safe-tablet);
    }

    .social-icon {
        padding: var(--social-icon-padding-tablet);
    }

    .social-icon svg {
        width: 24px;
        height: 24px;
    }

    .hero-footer {
        font-size: 0.7rem;
        padding: 0.75rem 0;
        padding-bottom: var(--padding-bottom-safe-tablet);
    }
}

@media (max-width: 480px) {
    .top-nav {
        gap: 1.5rem;
        padding: 1rem 0 0.5rem 0;
    }

    .nav-item {
        font-size: 0.75rem;
    }

    .hero-logo-container {
        padding-top: 0.5rem;
    }

    .hero-logo {
        max-width: 220px;
        width: 50vw;
    }

    .hero-video-container {
        width: 95%;
        max-width: 400px;
    }

    .hero-social {
        gap: 1.2rem;
        padding: 0 1rem;
        padding-bottom: var(--padding-bottom-safe-mobile);
    }

    .social-icon {
        padding: var(--social-icon-padding-mobile);
    }

    .social-icon svg {
        width: 22px;
        height: 22px;
    }

    .hero-footer {
        font-size: 0.65rem;
        padding: 0.5rem 0;
        padding-bottom: var(--padding-bottom-safe-mobile);
    }
}

/* Performance optimizations */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}