:root {
    /* Fonts */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Outfit', sans-serif;

    /* New Color Palette (Green/Nature/Tech) */
    --color-primary: #22291C;
    /* Deep Green - Backgrounds/Text */
    --color-accent: #608C3D;
    /* Vibrant Leaf Green - Highlights/Buttons */
    --color-light: #F4F7F2;
    /* Off-white with tint */
    --color-white: #ffffff;
    --color-dark-overlay: rgba(34, 41, 28, 0.9);

    /* Spacing */
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 32px;
    --spacing-xl: 64px;
    --spacing-xxl: 100px;

    /* Transitions */
    --transition-fast: 0.3s ease;
    --transition-smooth: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    --border-radius: 16px;
}

/* Animations */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fade-in-left {
    animation: fadeInLeft 0.8s ease-out forwards;
}

.fade-in-right {
    animation: fadeInRight 0.8s ease-out forwards;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-primary);
    background-color: var(--color-light);
    background-color: var(--color-light);
    overflow-x: hidden;
    /* Prevent horizontal scroll */
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: var(--spacing-md);
    letter-spacing: -0.02em;
}

h1 {
    font-size: 3.5rem;
}

h2 {
    font-size: 2.5rem;
}

h3 {
    font-size: 1.5rem;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-fast);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

/* Utilities */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.section {
    padding: var(--spacing-xxl) 0;
}

.text-center {
    text-align: center;
}

.text-white {
    color: var(--color-white);
}

.mb-lg {
    margin-bottom: var(--spacing-lg);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 14px 28px;
    border-radius: 50px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    cursor: pointer;
    border: none;
    transition: var(--transition-fast);
}

.btn-primary {
    background-color: var(--color-accent);
    color: var(--color-white);
    box-shadow: 0 4px 15px rgba(96, 140, 61, 0.3);
}

.btn-primary:hover {
    background-color: #4a6e2f;
    transform: translateY(-2px);
}

.btn-outline {
    border: 2px solid var(--color-accent);
    color: var(--color-accent);
    background: transparent;
}

.btn-outline:hover {
    background-color: var(--color-accent);
    color: var(--color-white);
}

/* Header */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: var(--spacing-md) 0;
    background-color: rgba(244, 247, 242, 0.8);
    /* matching light bg */
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    transition: all var(--transition-fast);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-logo img {
    height: 54px;
    /* Increased from 40px */
    width: auto;
}

.nav-links {
    display: flex;
    gap: var(--spacing-lg);
}

.nav-links a {
    font-weight: 500;
    color: var(--color-primary);
    font-size: 0.95rem;
}

.nav-links a:hover {
    color: var(--color-accent);
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    background: var(--color-primary);
    /* Fallback color */
    color: var(--color-white);
    overflow: hidden;
    padding-top: 80px;
    /* Header offset */
}

/* Background Video Styling */
#hero-video {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    z-index: 0;
    transform: translate(-50%, -50%);
    object-fit: cover;
    /* Ensures it covers the area */
}

/* Green Overlay for Contrast */
.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(34, 41, 28, 0.85);
    /* Deep Green tint */
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    /* Ensures text is above video and overlay */
    max-width: 600px;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 600px;
}

.hero h1 {
    font-size: 4rem;
    line-height: 1.1;
    margin-bottom: var(--spacing-lg);
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: var(--spacing-lg);
    max-width: 500px;
}

/* Cards & Grid Shared */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xl);
    align-items: center;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-lg);
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
}

/* Stats Styling */
.stats-grid {
    display: flex;
    gap: 60px;
    /* Spacing "respiro" */
    margin-top: 24px;
}

.stat-number {
    display: block;
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--color-accent);
    line-height: 1;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 1rem;
    font-weight: 500;
    opacity: 0.8;
    color: var(--color-primary);
}

.card {
    background: var(--color-white);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    transition: transform var(--transition-fast);
    border: 1px solid rgba(0, 0, 0, 0.02);
}

.card:hover {
    transform: translateY(-5px);
    border-color: var(--color-accent);
}

/* Section Specifics */
.section-marker {
    display: inline-block;
    color: var(--color-accent);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: var(--spacing-sm);
    font-size: 0.9rem;
    letter-spacing: 0.1em;
}

/* Contact CTA */
#contato {
    padding-bottom: var(--spacing-lg);
    /* Reduced spacing */
    background-color: var(--color-primary);
    color: white;
    text-align: center;
}

/* Footer */
footer {
    background-color: var(--color-primary);
    color: var(--color-white);
    padding: var(--spacing-lg) 0;
}

.footer-content {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.footer-socials {
    display: flex;
    gap: var(--spacing-md);
}

.social-link {
    color: var(--color-white);
    opacity: 0.6;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: opacity var(--transition-fast);
}

.social-link:hover {
    opacity: 1;
    color: var(--color-accent);
}

/* Mobile Menu Btn */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
    z-index: 1001;
}

.mobile-menu-btn span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--color-primary);
    transition: 0.3s;
    border-radius: 2px;
}

/* Diferencial Técnico Card */
.diferencial-card {
    transition: transform var(--transition-fast);
}

.diferencial-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1) !important;
    border-color: var(--color-accent) !important;
}

/* Financeiro Background Section */
.financeiro-bg {
    background-image: linear-gradient(rgba(34, 41, 28, 0.9), rgba(34, 41, 28, 0.8)), url('../img/finance_bg.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: relative;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

@media (hover: none) {
    .financeiro-bg {
        background-attachment: scroll;
        /* Fix for mobile scrolling jitter */
    }
}

/* Engenharia Text Alignment */
.engenharia-text {
    text-align: right;
}

/* Language Switcher */
.language-switcher {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    display: flex;
    flex-direction: column-reverse;
    /* Dropdown goes up */
    align-items: center;
    gap: 10px;
}

.language-btn {
    width: 60px;
    height: 60px;
    background-color: var(--color-primary);
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, background-color 0.3s ease;
    font-weight: 700;
    font-size: 0.9rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.language-btn:hover {
    transform: scale(1.1);
    background-color: var(--color-accent);
}

.language-dropdown {
    background: white;
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: all 0.3s ease;
    margin-bottom: 10px;
}

/* Show on hover OR when active class is present */
.language-switcher:hover .language-dropdown,
.language-switcher.active .language-dropdown {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.lang-option {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: #333;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s ease;
    text-align: center;
}

.lang-option:hover {
    background-color: #f0f0f0;
    color: var(--color-primary);
}

.lang-option.active {
    background-color: var(--color-primary);
    color: white;
}

/* Mobile */
@media (max-width: 768px) {
    .container {
        width: 100%;
        padding: 0 20px;
    }

    .hero::before {
        width: 100%;
        clip-path: none;
        opacity: 0.2;
    }

    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }

    .hero-buttons .btn {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
        gap: 40px;
        /* Comfortable gap for mobile */
    }

    /* Reverse Image/Text Order on Mobile for First Section */
    /* Target the specific grid in "Desafio Row" */
    #engenharia .grid-2:first-child {
        display: flex;
        flex-direction: column-reverse;
        /* Text atop, Image below */
    }

    /* Justify text on mobile for "O Cenário Atual" explanation */
    .fade-in-right p {
        text-align: center !important;
        padding-left: 0;
        padding-right: 0;
    }

    /* Ensure Solução Row maintains correct order (Image below text?) Or Image top? */
    /* User request specifically showed the first image below text. */
    /* Solução Row has inline order:2 for image, order:1 for text. On mobile flex-col, order applies.*/
    /* If we want consistent behavior: Text always top, Image always bottom on mobile: */

    .grid-2>div {
        width: 100%;
    }

    .engenharia-text {
        text-align: center !important;
        padding: 20px !important;
    }

    .hero h1 {
        font-size: 2rem;
        line-height: 1.2;
        margin-bottom: 20px;
    }

    .hero p {
        font-size: 1.1rem;
        margin-bottom: 30px;
        padding: 0 10px;
        /* Prevent text touching edges */
    }

    h2 {
        font-size: 1.7rem;
        line-height: 1.25;
    }

    h3 {
        font-size: 1.35rem;
    }

    /* Mobile Navigation */
    /* .mobile-menu-btn removed */
    .mobile-menu-btn {
        display: none !important;
    }

    .nav-links {
        display: none;
        /* Kept hidden as requested "retire essa opção" */
    }

    /* Stats Mobile */
    .stats-grid {
        justify-content: center;
        gap: 32px;
    }

    .stat-number {
        font-size: 2.5rem;
    }

    /* Center text on mobile for better alignment */
    .hero,
    .hero-content,
    .section {
        text-align: center;
    }

    /* Fixed Mobile Header Layout */
    .brand-logo img {
        height: 40px;
        /* Reduce logo size on mobile */
    }

    /* Adjust header button for mobile (Spanish fit) */
    .nav-container .btn {
        padding: 8px 14px !important;
        font-size: 0.75rem !important;
        white-space: nowrap;
        margin-left: auto;
        /* Push to right if needed */
    }

    .hero-content {
        margin: 0 auto;
    }

    /* Ensure grids stack nicely */
    .grid-2,
    .grid-3,
    .grid-4 {
        text-align: center;
        justify-items: center;
        /* Centers grid items if they have fixed width */
    }

    /* Language Switcher Mobile Fix */
    .language-switcher {
        bottom: 15px;
        right: 15px;
        transform: scale(0.8);
        transform-origin: bottom right;
    }

    .footer-content {
        flex-direction: column;
        gap: 30px;
        text-align: center;
    }

    /* Contact Card Mobile Fixes */
    #contato .card {
        padding: 24px !important;
        /* Reduce padding on mobile */
        text-align: center !important;
    }

    #contato h3 {
        font-size: 1.4rem !important;
    }

    #contato p {
        font-size: 1rem !important;
        word-break: break-word;
        /* Prevent email from overflowing */
    }

    #contato .btn {
        width: 100% !important;
        justify-content: center;
        font-size: 0.95rem !important;
        white-space: normal;
        /* Allow text wrapping in button */
        height: auto;
        padding: 12px 16px;
    }

    .footer-content>div {
        text-align: center !important;
    }

    .section {
        padding: 50px 0;
    }

    /* Override fixed height images on mobile for consistency */
    .fade-in-left img,
    .fade-in-right img,
    .grid-2 img {
        height: 250px !important;
        width: 100%;
        object-fit: cover;
        min-height: auto;
        max-height: none;
    }
}