@import url('https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@300;700&display=swap');

/* ============================================
   KV FOUNDRY - MAIN LANDING PAGE STYLES
   Layered starry night with mountain silhouette
   ============================================ */

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

body {
    font-family: 'Georgia', serif;
    color: #ffffff;
    overflow-x: hidden;
    background: #000000; /* Fallback for content below hero */
}

/* ============================================
   HERO SECTION - LAYERED BACKGROUND
   
   Layer structure (back to front):
   1. Background image (starry sky) - via CSS
   2. Animated stars - positioned in upper portion
   3. Mountain silhouette - img tag at bottom
   4. Content (logo, text, buttons)
   ============================================ */

.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    overflow: hidden;
    
    /* Layer 1: Starry sky background */
    background: 
        linear-gradient(
            to bottom,
            rgba(0, 0, 0, 0.3) 0%,
            rgba(0, 0, 0, 0.5) 50%,
            rgba(0, 0, 0, 0.7) 100%
        ),
        url('/images/copilot_StarBackground1.png') center center / cover no-repeat;
    background-color: #0a0e17; /* Fallback color */
}

/* ============================================
   LAYER 2: ANIMATED STARS
   Container for JS-generated twinkling stars
   ============================================ */

.stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 75%; /* Only populate upper 75% - mountains cover the rest */
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #ffffff;
    border-radius: 50%;
    animation: twinkle 3s ease-in-out infinite;
    will-change: opacity; /* Performance optimization */
}

/* Vary star sizes for depth */
.star:nth-child(3n) {
    width: 3px;
    height: 3px;
}

.star:nth-child(5n) {
    width: 1px;
    height: 1px;
}

@keyframes twinkle {
    0%, 100% { 
        opacity: 0.3;
        transform: scale(1);
    }
    50% { 
        opacity: 1;
        transform: scale(1.2);
    }
}

/* ============================================
   LAYER 3: MOUNTAIN SILHOUETTE
   Using <img> for proper aspect ratio control
   ============================================ */

.mountain-foreground {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 2;
    pointer-events: none;
    line-height: 0; /* Removes any gap below the image */
}

.mountain-foreground img {
    display: block;
    width: 100%;
    height: auto; /* Maintains aspect ratio */
    
    /* Alternative: If you want the mountain to always fill width 
       and crop height on very wide screens, use:
       object-fit: cover;
       object-position: bottom center;
       max-height: 50vh;
    */
}

/* ============================================
   LAYER 4: CONTENT
   ============================================ */

.content-wrapper {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-bottom: 15vh; /* Push content up to avoid mountain overlap */
}

.logo {
    width: 250px;
    height: auto;
    margin-bottom: 3rem;
    /* Subtle glow effect */
    filter: drop-shadow(0 0 30px rgba(255, 255, 255, 0.1));
    animation: fadeInDown 1s ease-out;
}

h1 {
    font-family: 'Roboto Slab', serif;
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 300;
    letter-spacing: 0.1em;
    margin-bottom: 2rem;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
    animation: fadeIn 1.2s ease-out 0.3s both;
}

/* Navigation Links */
.nav-link {
    display: inline-block;
    color: #ffffff;
    text-decoration: none;
    font-size: 1.1rem;
    padding: 12px 28px;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 4px;
    margin: 10px;
    transition: 
        background-color 0.3s ease,
        border-color 0.3s ease,
        transform 0.2s ease,
        box-shadow 0.3s ease;
    animation: fadeIn 1.2s ease-out 0.6s both;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.95);
    color: #0a0e17;
    border-color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.nav-link:active {
    transform: translateY(0);
}

/* ============================================
   CONTACT SECTION
   ============================================ */

.contact-section {
    background: #000000;
    padding: 80px 20px;
    text-align: center;
}

.divider {
    width: 80px;
    height: 1px;
    background: #444444;
    margin: 0 auto 40px;
}

.contact-info {
    margin-top: 40px;
}

.contact-info a {
    color: #888888;
    text-decoration: none;
    font-size: 1.1rem;
    transition: color 0.3s ease;
}

.contact-info a:hover {
    color: #ffffff;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .logo {
        width: 180px;
        margin-bottom: 2rem;
    }
    
    h1 {
        font-size: 2rem;
        letter-spacing: 0.05em;
    }

    .nav-link {
        display: block;
        width: 100%;
        max-width: 280px;
        font-size: 1rem;
        padding: 14px 20px;
        margin: 8px auto;
    }
    
    .content-wrapper {
        padding-bottom: 20vh;
    }
    
    /* On very small screens, mountains might be too tall */
    .mountain-foreground img {
        max-height: 40vh;
        width: auto;
        min-width: 100%;
        object-fit: cover;
        object-position: center bottom;
    }
}

/* For very wide screens, limit mountain height */
@media (min-width: 1400px) and (min-aspect-ratio: 2/1) {
    .mountain-foreground img {
        max-height: 45vh;
        object-fit: cover;
        object-position: center bottom;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .star {
        animation: none;
        opacity: 0.6;
    }
}

/* Focus styles for keyboard navigation */
.nav-link:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 4px;
}