/* =========================================
   1. CSS Variables & Theming
   ========================================= */
:root {
    /* Core Defaults (Home Mode) */
    --primary-color: #2563EB;
    /* Bright Blue */
    --secondary-color: #f3f4f6;
    /* Light Gray */
    --accent-color: #F59E0B;
    /* Amber/Gold */
    --text-color: #1f2937;
    /* Dark Gray */
    --bg-color: #ffffff;
    /* White */
    --header-bg: rgba(255, 255, 255, 0.95);
    --hero-overlay: linear-gradient(135deg, rgba(37, 99, 235, 0.9), rgba(255, 255, 255, 0.0));
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --transition-speed: 0.3s;

    /* Font Families */
    --font-heading: 'Roboto', sans-serif;
    --font-body: 'Inter', sans-serif;
}

/* Industrial Mode Override */
body.mode-industrial {
    --primary-color: #FF6B00;
    /* Safety Orange */
    --secondary-color: #111827;
    /* Very Dark Gray */
    --accent-color: #FCD34D;
    /* Safety Yellow */
    --text-color: #f9fafb;
    /* Light Gray/White */
    --bg-color: #1f2937;
    /* Dark slate */
    --header-bg: rgba(255, 255, 255, 0.95);
    /* Keep light header in industrial mode */
    --hero-overlay: linear-gradient(135deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.4));
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: var(--font-body);
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.6;
    transition: background-color 0.5s ease, color 0.5s ease;
    overflow-x: hidden;
    /* Prevent horizontal scrolling */
}

html {
    overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    margin-bottom: 1rem;
    line-height: 1.2;
}

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

ul {
    list-style: none;
}

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

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.section {
    padding: 5rem 0;
}

/* Utilities */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-speed);
    border: 2px solid transparent;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

.btn-outline {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

body.mode-industrial .btn-outline {
    border-color: white;
    color: white;
}

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

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

/* =========================================
   3. Header & Navigation
   ========================================= */
.top-bar {
    background: var(--primary-color);
    color: white;
    text-align: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 51px;
    /* 1px overlap with header */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    /* Highest priority */
    margin: 0;
    border: none;
    box-shadow: none;
    transition: background 0.5s ease;
}

.seo-title {
    font-size: 1.1rem;
    /* Increased 10% */
    font-weight: 600;
    margin: 0;
    letter-spacing: 0.3px;
    font-family: var(--font-body);
}

@media (max-width: 768px) {
    .top-bar {
        height: 41px;
        /* 1px overlap */
        padding: 0;
    }

    .seo-title {
        font-size: 1rem;
        /* Increased 20% (approx) */
        line-height: 1.1;
        letter-spacing: 0px;
        word-spacing: -1px;
    }
}

.header {
    background: #ffffff !important;
    position: fixed;
    top: 50px;
    margin: 0;
    border: none;
    left: 0;
    width: 100%;
    z-index: 1000;
    backdrop-filter: none;
    box-shadow: none !important;
    height: 80px;
    /* Constant height */
    padding: 0;
    /* Use flex alignment instead of padding */
    display: flex;
    align-items: center;
    /* transition: height 0.3s ease; - Removed to keep content stable */
}

@media (max-width: 768px) {
    .header {
        top: 40px;
        height: 80px;
        /* Constant height in mobile */
        padding: 0;
        /* Removed padding-top to center content */
        background: #ffffff !important;
        box-shadow: none !important;
        border: none;
        border-bottom: none !important;
        margin: 0;
        margin-bottom: 0 !important;
        display: flex;
        align-items: center;
        /* Perfect vertical centering */
    }
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

@media (max-width: 768px) {
    .header-container {
        display: flex;
        justify-content: space-between;
        /* Logo left, switcher right */
        align-items: center;
        width: 100%;
        padding: 0 1.5rem;
    }
}

.logo {
    display: flex;
    align-items: center;
    padding: 2px 0;
    /* More compact */
    margin-right: 2rem;
}

.logo a {
    display: flex;
    align-items: center;
    height: 100%;
}

.logo-img {
    height: 78px !important;
    /* Increased 20% (65 * 1.2) */
    width: auto;
    display: block;
    object-fit: contain;
    transition: transform 0.3s ease, filter 0.3s ease;
}

@media (max-width: 768px) {
    .logo-img {
        height: 68px !important;
        /* Increased 10% (62 * 1.1) */
    }
}

/* Modo Industrial - Logo Contrast Refinement */
body.mode-industrial .logo-img {
    filter: brightness(1.2);
    /* User requested brightness increase */
}

.logo-img:hover {
    transform: scale(1.05);
}

.nav-menu {
    display: flex;
    gap: 2rem;
}

.nav-menu a {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-color);
    transition: color 0.3s;
}

.nav-menu a:hover {
    color: var(--primary-color);
}

body.mode-industrial .nav-menu a {
    color: #1f2937;
    /* Dark text for white header in industrial mode */
}

body.mode-industrial .nav-menu a:hover {
    color: var(--primary-color);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}



.mode-toggle {
    position: relative;
    display: flex;
    background: #f3f4f6;
    padding: 4px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

body.mode-industrial .mode-toggle {
    background: #111827;
    border-color: rgba(255, 255, 255, 0.1);
}

.mode-option {
    position: relative;
    z-index: 2;
    background: none;
    border: none;
    padding: 6px 14px;
    /* Reduced for symmetry with btn-sm */
    font-size: 0.9rem;
    font-weight: 600;
    color: #4b5563;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.3s;
}

body.mode-industrial .mode-option {
    color: #9ca3af;
}

.mode-option[aria-selected="true"] {
    color: #fff;
}

.mode-thumb {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    background: var(--primary-color);
    border-radius: 8px;
    z-index: 1;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-active="industrial"] .mode-thumb {
    transform: translateX(100%);
}

/* Hero-Services Section */
.hero-services {
    background-image: linear-gradient(rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.85)), url('../assets/images/services-bg.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: relative;
    padding-top: 131px;
    /* Normalized: 51 (top-bar) + 80 (header) */
    min-height: 100vh;
}

body.mode-industrial .hero-services {
    background-image: linear-gradient(rgba(31, 41, 55, 0.9), rgba(31, 41, 55, 0.9)),
        url('../assets/images/industrial-services-bg.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    padding-top: 131px;
    /* Match: top-bar(51) + header(80) */
    padding-bottom: 0;
}

.hero-content-wrapper {
    padding: 2rem 0 3rem 0;
    /* Reduced from 4rem/6rem for mobile-first feel, but will refine in media query if needed */
}

.hero-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
        "badge image"
        "content image";
    align-items: start;
    gap: 2rem;
    padding-top: 2rem;
}

.hero-badge {
    grid-area: badge;
    display: inline-block;
    padding: 8px 16px;
    background: var(--primary-color);
    color: #fff;
    border-radius: 6px;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
    justify-self: start;
    margin-left: 0;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.hero-content {
    grid-area: content;
    text-align: left;
}

.hero-title {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    letter-spacing: -1px;
}

.hero-description {
    font-size: 1.25rem;
    margin-bottom: 2.5rem;
    max-width: 100%;
}

.hero-image {
    grid-area: image;
    grid-row: span 2;
    display: flex;
    justify-content: flex-end;
}

.hero-img {
    width: 100%;
    max-width: 600px;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
}

@media (max-width: 991px) {
    .hero-services {
        padding-top: 65px !important;
        /* Half of original 131px */
    }

    .hero-content-wrapper {
        padding: 2rem 0 3rem 0;
    }

    .hero-container {
        grid-template-columns: 1fr;
        grid-template-areas:
            "badge"
            "content"
            "image";
        text-align: center;
        padding-top: 1rem;
        /* Half of original 2rem */
    }

    .hero-badge {
        justify-self: center;
        margin-left: 0;
        margin-bottom: 1rem;
    }

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

    .hero-image {
        justify-content: center;
    }
}

/* Visibility Control */
.home-only {
    display: none;
}

body.mode-home .home-only {
    display: block;
}

body.mode-industrial .home-only {
    display: none;
}

/* Ocultar Portfolio en modo Home */
body.mode-home .portfolio {
    display: none;
}

/* Ocultar About en modo Home */
body.mode-home .about {
    display: none;
}

/* Mostrar About solo en modo Industrial */
body.mode-industrial .about {
    display: block;
}

/* Hero content solo visible en Home */
body.mode-home .hero-content-wrapper {
    display: block;
}

body.mode-industrial .hero-content-wrapper {
    display: none;
}

.industrial-only {
    display: none;
}

body.mode-industrial .industrial-only {
    display: block;
}

/* Services Grid & Cards */
.services-wrapper {
    position: relative;
    z-index: 2;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
    display: none;
}

body.mode-home .services-home {
    display: grid;
}

/* Grid 3 columnas industrial - Only for desktop */
body.mode-industrial .services-industrial {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    max-width: 1200px;
    margin: 0 auto;
}

@media (min-width: 992px) {
    body.mode-industrial .services-industrial {
        grid-template-columns: repeat(3, 1fr);
    }
}

.service-card {
    background: var(--bg-color);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid rgba(0, 0, 0, 0.05);
    text-align: center;
}

body.mode-industrial .service-card {
    background: #1f2937;
    border-color: rgba(255, 255, 255, 0.1);
}

.service-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 20px -5px rgba(0, 0, 0, 0.15);
}

.service-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

/* Portfolio Section */
.portfolio {
    padding: 5rem 0;
    position: relative;
    background-color: #f3f4f6;
    /* Default Home Background */
}

body.mode-industrial .portfolio {
    background-image: linear-gradient(rgba(31, 41, 55, 0.9), rgba(31, 41, 55, 0.9)),
        url('../assets/images/industrial-services-bg.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    padding-top: 3rem;
    padding-bottom: 5rem;
    margin-top: 0;
}

/* Portfolio Item Visibility */
.home-item,
.industrial-item {
    display: none;
}

body.mode-home .home-item {
    display: block;
}

body.mode-industrial .industrial-item {
    display: block;
}

/* Visibility classes */
.home-only {
    display: block !important;
}

.industrial-only {
    display: none !important;
}

body.mode-industrial .home-only {
    display: none !important;
}

body.mode-industrial .industrial-only {
    display: block !important;
}

/* Portafolio Industrial - Relocated Header Styling */
body.mode-industrial .section-header.industrial-only {
    margin-bottom: 2rem;
    /* Compact spacing */
    text-align: center;
}

body.mode-industrial .section-header.industrial-only h2 {
    font-size: 2.8rem;
    /* Adjusted for balance */
    font-weight: 700;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

body.mode-industrial .section-header.industrial-only p {
    font-size: 1.2rem;
    opacity: 0.8;
}

/* Reducción de espaciado en modo industrial para aspecto compacto */
body.mode-industrial #portfolio.section.portfolio {
    padding-top: 0.5rem;
}

body.mode-industrial .portfolio-grid {
    margin-top: 0;
}

body.mode-industrial .services-wrapper {
    margin-bottom: 1rem;
}

.portfolio-subtitle {
    display: block;
    font-size: 1.8rem;
    font-weight: 500;
    margin-top: 1.5rem;
    margin-bottom: 3rem;
    color: var(--text-color);
    line-height: 1.4;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.portfolio-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    height: 350px;
}

.portfolio-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.portfolio-item:hover img {
    transform: scale(1.1);
}

.portfolio-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.4) 50%, transparent 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 2rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.portfolio-item:hover .portfolio-overlay {
    opacity: 1;
}

.portfolio-overlay h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.portfolio-overlay p {
    color: #fff;
    font-size: 0.9rem;
}

/* About Section */
.about-container {
    display: flex;
    align-items: center;
    gap: 4rem;
}

.about-text {
    flex: 1;
}

.about-image {
    flex: 1;
    position: relative;
}

.about-image img {
    width: 100%;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
}

.features-list {
    margin-top: 2rem;
}

.features-list li {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    font-weight: 500;
}

.features-list i {
    color: var(--primary-color);
    margin-right: 1rem;
    font-size: 1.25rem;
}

/* Testimonials */
.testimonials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.testimonial-card {
    background: var(--bg-color);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    border-bottom: 4px solid var(--primary-color);
}

.quote {
    font-style: italic;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    opacity: 0.9;
}

.author .name {
    display: block;
    font-weight: 700;
    color: var(--primary-color);
}

.author .role {
    font-size: 0.85rem;
    opacity: 0.6;
}

/* Contact */
.contact-container {
    display: flex;
    gap: 4rem;
}

.contact-info {
    flex: 1;
}

.contact-form-wrapper {
    flex: 1;
    background: var(--bg-color);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: transparent;
    color: inherit;
}

body.mode-industrial .form-group input,
body.mode-industrial .form-group textarea {
    border-color: #4b5563;
}

/* Footer */
.footer {
    background: #111827;
    color: #f3f4f6;
    padding: 4rem 0 2rem;
}

.footer-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 3rem;
}

.footer-brand h4 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.footer-links a {
    margin-left: 2rem;
    color: #9ca3af;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: #fff;
}

.floating-whatsapp {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #25D366;
    color: #fff;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: transform 0.3s;
}

.floating-whatsapp:hover {
    transform: scale(1.1);
}

@media (max-width: 768px) {

    .about-container,
    .contact-container {
        flex-direction: column;
        text-align: center;
    }

    .footer-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .footer-links a {
        margin: 1rem;
    }

    /* Mobile Header Cleanup */
    .header-actions .btn-primary {
        display: none !important;
    }

    .header-actions {
        gap: 0.5rem;
    }

    .mode-toggle {
        padding: 4px;
        border-radius: 12px;
        transform: scale(1.05);
        /* Slightly smaller for better balance */
        transform-origin: right center;
    }

    .logo {
        margin-right: 0;
    }

    .nav-menu {
        position: fixed;
        top: 121px;
        /* 41 (top-bar) + 80 (header) */
        left: -100%;
        width: 100%;
        height: calc(100vh - 121px);
        background: #ffffff;
        flex-direction: column;
        align-items: center;
        padding-top: 3rem;
        transition: left 0.3s ease;
        backdrop-filter: none;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-menu a {
        font-size: 1.2rem;
        margin-bottom: 2rem;
    }
}