/* CSS Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    color: #0F172A;
    background: #fff;
    overflow-x: hidden;
}

img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
}

input, button, textarea, select {
    font: inherit;
}

/* CSS Variables for consistent theming */
:root {
    --primary: #475569;
    --primary-dark: #334155;
    --accent: #3B82F6;
    --accent-hover: #2563EB;
    --text-primary: #0F172A;
    --text-secondary: #64748B;
    --text-light: #94A3B8;
    --bg-primary: #ffffff;
    --bg-secondary: #F1F5F9;
    --border: #E2E8F0;
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-lg: 16px;
    --transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
    --container-padding: clamp(1rem, 5vw, 2.5rem);
}

/* Utility Classes */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

/* MODIFICATION: Header is now hidden by default and appears on scroll */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    will-change: transform, opacity;
    
    /* Hide header by default */
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.4s ease-out, opacity 0.4s ease-out;
}

/* This class makes the header visible */
.header.is-visible {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    min-height: 80px;
}

.logo {
    text-decoration: none;
    transition: opacity 0.5s ease-in-out;
}

.logo img {
    height: 55px;
    width: auto;
}

#headerLogo {
    opacity: 0; /* Initially hidden for the animation */
}

.logo:hover {
    opacity: 0.85;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2.5rem;
    margin: 0;
    padding: 0;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
    position: relative;
    padding: 0.5rem 0;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: var(--transition);
    transform: translateX(-50%);
}

.nav-links a:hover, .nav-links a.active {
    color: var(--primary);
}

.nav-links a:hover::after, .nav-links a.active::after {
    width: 100%;
}

.mobile-menu {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 0.5rem;
    gap: 4px;
    background: none;
    border: none;
}

.mobile-menu span {
    width: 24px;
    height: 2px;
    background: var(--primary);
    transition: var(--transition);
    transform-origin: center;
}

.mobile-menu.active span:nth-child(1) { transform: rotate(45deg) translate(5px,5px); }
.mobile-menu.active span:nth-child(2) { opacity: 0; }
.mobile-menu.active span:nth-child(3) { transform: rotate(-45deg) translate(7px,-6px); }

/* --- Hero Section with Multi-Stage Animation --- */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    position: relative;
    overflow: hidden;
}

.hero-video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.hero-video-container video,
.hero-video-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

#heroBgImage {
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

#heroBgImage.is-visible {
    opacity: 1;
}

.hero-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0); /* Start transparent */
    z-index: 2;
    transition: background-color 1s ease-in-out;
}

.hero-video-overlay.is-darkened {
    background-color: rgba(15, 23, 42, 0.7); /* Darken on cue */
}

.hero-animation-wrapper {
    width: 100%;
    z-index: 4;
}

#hero-main-content {
    position: relative;
    width: 100%;
    height: 400px; /* Give a fixed height for positioning context */
}

#hero-logo-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(2); /* Start centered and 2x larger */
    opacity: 0;
    /* Animate only transform and opacity for smoothness */
    transition: transform 1.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 1s ease;
    will-change: transform, opacity; /* Performance hint */
}

#hero-logo-container.is-visible {
    opacity: 1;
}

/* Make the hero logo white */
#hero-logo-container.is-visible img {
    filter: brightness(0) invert(1);
}

/* The .is-staged class is only used as a trigger to fade in the text content */
.hero.is-staged #hero-logo-container {
    /* The transform is now handled by script.js */
}

#hero-logo-container img {
    width: clamp(150px, 20vw, 250px);
}

/* Text is now always centered after the animation. */
#heroTextContent {
    position: absolute;
    top: 50%;
    left: 50%;
    /* Position centered and fade in */
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 1s ease-in-out 0.5s;
    text-align: center;
    max-width: 650px; /* Increased max-width slightly */
    width: 90%; /* Use percentage for better responsiveness */
}

/* Staged state: text fades in */
.hero.is-staged #heroTextContent {
    opacity: 1;
}

.hero h1 {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    font-weight: 700;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.hero p {
    font-size: clamp(1rem, 2vw, 1.2rem);
    margin-bottom: 2.5rem;
    opacity: 0.9;
    font-weight: 400;
}

.cta-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--accent);
    color: white;
    padding: 1rem 2rem;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
    border: 2px solid var(--accent);
}

.cta-button:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Scroll indicator */
.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: white;
    opacity: 0;
    transition: opacity 1s ease-in-out 1s;
    z-index: 5;
}

.scroll-indicator.is-visible {
    opacity: 0.7;
}

.scroll-indicator span {
    font-size: 0.875rem;
    font-weight: 500;
}

.scroll-arrow {
    width: 24px;
    height: 24px;
    border: 2px solid currentColor;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
    animation: float 2s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

/* General Section Styling */
.section {
    padding: clamp(4rem, 8vw, 7rem) 0;
}

.section.alt {
    background: var(--bg-secondary);
}

.section-header {
    text-align: center;
    margin-bottom: clamp(3rem, 6vw, 5rem);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.section-title {
    font-size: clamp(2rem, 4vw, 3rem);
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.section-subtitle {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: var(--text-secondary);
    font-weight: 400;
    line-height: 1.7;
}

/* Companies Section */
.companies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 450px), 1fr));
    gap: clamp(2rem, 4vw, 3rem);
    max-width: 1200px;
    margin: 0 auto;
}

.company-card {
    background: var(--bg-primary);
    padding: clamp(2rem, 4vw, 3rem);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.company-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-xl);
    transform: translateY(-8px);
}

.company-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
}

.company-card h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-weight: 600;
}

.company-card p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.company-features {
    list-style: none;
    display: grid;
    gap: 0.75rem;
}

.company-features li {
    color: var(--text-secondary);
    font-size: 0.95rem;
    position: relative;
    padding-left: 1.5rem;
}

.company-features li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: 600;
}

/* Stats Section */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
    gap: clamp(2rem, 4vw, 3rem);
    max-width: 1000px;
    margin: clamp(3rem, 6vw, 5rem) auto 0;
}

.stat-item {
    text-align: center;
    padding: clamp(2rem, 3vw, 2.5rem);
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.stat-number {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    color: var(--accent);
    display: block;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Contact Section */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: clamp(2rem, 4vw, 3rem);
    max-width: 800px;
    margin: clamp(2rem, 4vw, 3rem) auto 0;
}

.contact-item {
    padding: clamp(2rem, 3vw, 2.5rem);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    text-align: center;
}

.contact-item h4 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.contact-item p a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

/* Footer */
.footer {
    background: var(--primary);
    color: var(--text-light);
    padding: clamp(3rem, 5vw, 4rem) 0 2rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: clamp(2rem, 4vw, 3rem);
    margin-bottom: 2rem;
}

.footer-section h4 {
    color: var(--accent);
    font-size: 1.1rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.footer-section a {
    color: var(--text-light);
    text-decoration: none;
    display: block;
    margin-bottom: 0.5rem;
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 2rem;
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Responsive Breakpoints */
@media (max-width: 992px) {
    /* No special overrides needed for the hero animation anymore */
}

@media (max-width: 768px) {
    .nav-links { display: none; }
    .mobile-menu { display: flex; }
    
    .nav-links.mobile-open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid var(--border);
        padding: 1rem;
        gap: 1rem;
        box-shadow: var(--shadow-lg);
    }

    .hero { min-height: 80vh; }
    .scroll-indicator { display: none; }
    .companies-grid, .contact-grid { grid-template-columns: 1fr; }
    .stats { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
    .section { padding: 3rem 0; }
}

@media (max-width: 480px) {
    .stats { grid-template-columns: 1fr; }
}

/* Intersection observer animation classes */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-up.visible {
    opacity: 1;
    transform: translateY(0);
}