/* --- CORE VARIABLES --- */
:root {
    /* Fonts (Explicit Definition) */
    --font-main: 'Montserrat', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'Fira Code', monospace;

    /* Palette - Premium Dark Theme */
    --bg-dark: #0B0F14;      /* Deep Gunmetal */
    --surface-1: rgba(20, 25, 35, 0.6);
    --surface-2: rgba(30, 35, 45, 0.7);
    --surface-3: rgba(40, 45, 60, 0.75);
    
    --border-light: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.2);
    
    /* Text Colors */
    --text-main: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-tertiary: #64748B;
    
    /* Brand Colors */
    --accent: #FFC107;
    --accent-glow: rgba(255, 193, 7, 0.3);
    --cyan: #0EA5E9;
    --cyan-glow: rgba(14, 165, 233, 0.3);
    
    --success: #10B981;
    --danger: #EF4444;
    
    /* Layout & Spacing Tokens */
    --sidebar-width: 80px;
    --sidebar-expanded: 260px;
    --radius-md: 12px;
    --radius-sm: 6px;
    
    --space-xs: 8px;
    --space-sm: 16px;
    --space-md: 32px;
    --space-lg: 64px;
    --space-xl: 128px;
    
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* --- RESET & BASE --- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
body.modal-open { overflow: hidden; padding-right: 8px; }

body { 
    font-family: var(--font-body); 
    background-color: var(--bg-dark); 
    color: var(--text-main); 
    margin: 0; 
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-main); margin: 0; line-height: 1.2; }
a { text-decoration: none; color: inherit; transition: var(--transition-smooth); }
ul { list-style: none; padding: 0; margin: 0; }
button { border: none; outline: none; font-family: inherit; cursor: pointer; background: none; }

/* Enhanced Focus Visibility */
:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--bg-dark), 0 0 0 4px var(--accent);
    border-radius: 2px;
}

/* --- CUSTOM CURSOR (Desktop Only) --- */
@media (hover: hover) and (pointer: fine) {
    * { cursor: none !important; }
    
    #cursor-dot, #cursor-ring {
        position: fixed; top: 0; left: 0; transform: translate(-50%, -50%);
        border-radius: 50%; pointer-events: none; z-index: 9999;
        will-change: transform;
    }
    #cursor-dot {
        width: 6px; height: 6px; background: var(--accent);
        box-shadow: 0 0 8px var(--accent-glow);
    }
    #cursor-ring {
        width: 30px; height: 30px; border: 1px solid rgba(255, 255, 255, 0.2);
    }
    body.hovering #cursor-ring {
        width: 50px; height: 50px; border-color: var(--cyan);
        background: rgba(14, 165, 233, 0.1);
        border-width: 2px;
    }
    body.hovering #cursor-dot { background: var(--cyan); }
}

@media (hover: none) {
    #cursor-dot, #cursor-ring { display: none; }
}

/* --- UTILS --- */
.eng-mono { font-family: var(--font-mono); letter-spacing: -0.5px; }
.text-accent { color: var(--accent); }
.text-cyan { color: var(--cyan); }
.text-muted { color: var(--text-secondary); }
.hidden { display: none !important; }

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

/* --- BACKGROUND 3D --- */
#bg-3d { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; }
.bg-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at 50% 50%, rgba(11,15,20,0) 0%, rgba(11,15,20,0.4) 60%, rgba(11,15,20,0.95) 100%);
    z-index: -1; pointer-events: none;
}

/* --- SIDEBAR --- */
.eng-sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    background: rgba(11, 15, 20, 0.85);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid var(--border-light);
    z-index: 1000;
    display: flex; flex-direction: column; align-items: center;
    padding: var(--space-md) 0;
    transition: width 0.3s cubic-bezier(0.2, 0, 0, 1);
    overflow: hidden;
}

.eng-sidebar:hover { width: var(--sidebar-expanded); border-right-color: var(--accent-glow); }

.sidebar-header { 
    width: 100%; display: flex; align-items: center; justify-content: flex-start; 
    padding-left: 28px; margin-bottom: var(--space-lg); 
    white-space: nowrap; overflow: hidden;
}

.logo-icon { 
    font-size: 1.6rem; color: var(--accent); min-width: 24px; text-align: center; 
    filter: drop-shadow(0 0 10px var(--accent-glow));
}

.logo-text { 
    margin-left: 20px; font-weight: 700; text-transform: uppercase; font-size: 1rem; 
    opacity: 0; transition: opacity 0.2s; color: var(--text-main); letter-spacing: 1px;
}
.eng-sidebar:hover .logo-text { opacity: 1; transition-delay: 0.1s; }

.eng-nav { width: 100%; display: flex; flex-direction: column; gap: 4px; }

.nav-link {
    display: flex; align-items: center;
    padding: 12px 28px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    position: relative;
    white-space: nowrap;
    transition: var(--transition-smooth);
}

.nav-link i { min-width: 24px; text-align: center; font-size: 1.1rem; transition: 0.3s; }
.nav-link span { margin-left: 20px; opacity: 0; transition: opacity 0.2s; }
.eng-sidebar:hover .nav-link span { opacity: 1; transition-delay: 0.05s; }

.nav-link:hover { color: var(--text-main); background: var(--surface-1); }
.nav-link:hover i { color: var(--accent); transform: translateX(2px); text-shadow: 0 0 10px var(--accent-glow); }

.nav-link.active { color: var(--accent); background: linear-gradient(90deg, rgba(255, 193, 7, 0.05), transparent); border-left: 3px solid var(--accent); padding-left: 25px; }
.nav-link.active i { color: var(--accent); text-shadow: 0 0 10px var(--accent-glow); }

.system-links { margin-top: auto; width: 100%; padding: 0 var(--space-sm); }

.sys-btn {
    display: flex; align-items: center;
    width: 100%; padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-tertiary); font-size: 0.75rem;
    font-weight: 600; text-transform: uppercase;
    margin-bottom: 8px;
    transition: var(--transition-smooth);
    white-space: nowrap; overflow: hidden;
}

.sys-btn i { min-width: 24px; text-align: center; }
.sys-btn span { margin-left: 12px; opacity: 0; transition: opacity 0.2s; }
.eng-sidebar:hover .sys-btn span { opacity: 1; }

.sys-btn:hover { 
    background: rgba(255, 193, 7, 0.05); 
    border-color: var(--accent);
    color: var(--accent);
}

/* --- SCADA HUD (Refined) --- */
#scada-hud {
    position: fixed; bottom: 30px; right: 30px; width: 240px;
    background: rgba(11, 15, 20, 0.9);
    border: 1px solid var(--border-light);
    border-left: 3px solid var(--accent);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    padding: 20px; border-radius: var(--radius-sm); z-index: 100;
    font-family: var(--font-mono);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transition: transform 0.4s cubic-bezier(0.2, 0, 0, 1), opacity 0.4s;
    display: none;
}

#scada-hud.minimized {
    transform: translateY(calc(100% - 46px));
    opacity: 0.9;
    border-left-width: 1px;
}
#scada-hud.minimized:hover { opacity: 1; border-left-width: 3px; }

@media(min-width: 1024px) { #scada-hud { display: block; } }

.scada-header {
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid var(--border-light); padding-bottom: 10px; margin-bottom: 15px;
    height: 24px;
}

#scada-hud.minimized .scada-header { border-bottom: none; margin-bottom: 0; }

.scada-title { font-size: 0.7rem; color: var(--text-tertiary); letter-spacing: 1px; font-weight: 700; }

.scada-controls { display: flex; gap: 8px; align-items: center; }
.scada-status { width: 6px; height: 6px; background: var(--success); border-radius: 50%; box-shadow: 0 0 6px var(--success); animation: blink 3s infinite ease-in-out; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.scada-toggle { font-size: 0.8rem; color: var(--text-tertiary); cursor: pointer; transition: 0.2s; padding: 5px;}
.scada-toggle:hover { color: var(--text-main); }

.scada-content { transition: opacity 0.3s; }
#scada-hud.minimized .scada-content { opacity: 0; pointer-events: none; }

.scada-row { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 0.75rem; }
.scada-label { color: var(--cyan); }
.scada-val { color: var(--text-main); font-weight: 600; }

.scada-graph {
    height: 30px; width: 100%; margin-top: 15px;
    border-top: 1px dashed var(--border-light);
    position: relative; overflow: hidden; opacity: 0.7;
}
.scada-wave {
    position: absolute; bottom: 0; left: 0; width: 200%; height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='30' viewBox='0 0 100 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 15 Q 25 30 50 15 T 100 15' stroke='%23FFC107' fill='none' stroke-width='2' stroke-opacity='0.5'/%3E%3C/svg%3E");
    background-repeat: repeat-x;
    animation: waveMove 3s linear infinite;
}
@keyframes waveMove { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* --- HERO & SECTIONS --- */
.eng-wrapper { margin-left: var(--sidebar-width); transition: margin 0.3s cubic-bezier(0.2, 0, 0, 1); }

.hero { 
    min-height: 90vh; display: flex; align-items: center; 
    padding: var(--space-xl) 0; position: relative;
}

.hero-content { max-width: 800px; z-index: 2; }

.hero h1 { 
    font-size: clamp(2.5rem, 5vw, 4.5rem); 
    font-weight: 800;
    line-height: 1.1; 
    letter-spacing: -0.02em; 
    margin-bottom: var(--space-md); 
    color: var(--text-main);
}

.hero h1 span { 
    background: linear-gradient(135deg, #fff 0%, #94A3B8 100%);
    background-clip: text; /* Correção para o aviso do VS Code */
    -webkit-background-clip: text; 
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: 1.125rem; color: var(--text-secondary); max-width: 580px;
    margin-bottom: var(--space-lg);
    line-height: 1.6;
    border-left: 2px solid var(--accent);
    padding-left: var(--space-sm);
}

/* Standard Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    padding: 14px 28px; border-radius: var(--radius-sm);
    font-weight: 600; text-transform: uppercase; font-size: 0.85rem; letter-spacing: 0.5px;
    transition: var(--transition-smooth);
    cursor: pointer; text-decoration: none;
}

.btn-primary {
    background: var(--accent); color: #000;
    border: 1px solid var(--accent);
}
.btn-primary:hover {
    background: #ffe082; border-color: #ffe082;
    transform: translateY(-2px); box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-ghost {
    background: transparent; color: var(--text-main);
    border: 1px solid var(--border-light);
}
.btn-ghost:hover {
    background: var(--surface-1); border-color: var(--text-secondary);
}

.btn-full { width: 100%; }

.scroll-down {
    position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    color: var(--text-tertiary); font-size: 0.7rem; letter-spacing: 2px;
    animation: bounce 2s infinite ease-in-out;
}
@keyframes bounce { 0%, 100% {transform: translateX(-50%) translateY(0);} 50% {transform: translateX(-50%) translateY(-5px);} }

.section { padding: var(--space-xl) 0; border-top: 1px solid rgba(255,255,255,0.02); position: relative; z-index: 2; }

.section-header { margin-bottom: var(--space-lg); text-align: center; }
.section-header h2 { 
    font-size: 2rem; text-transform: uppercase; letter-spacing: 1px; 
    color: var(--text-main); display: inline-block; position: relative;
}
.section-header h2::after {
    content: ''; display: block; width: 40px; height: 3px; background: var(--accent);
    margin: 15px auto 0; border-radius: 2px;
}

/* Services Grid */
.services-grid { 
    display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: var(--space-md); 
}

.service-card {
    background: var(--surface-1);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md); padding: 32px;
    transition: var(--transition-smooth);
    position: relative; overflow: hidden;
}

.service-card:hover {
    transform: translateY(-6px);
    background: linear-gradient(180deg, var(--surface-2), rgba(30, 35, 45, 0.4));
    border-color: var(--border-hover);
    box-shadow: 0 15px 30px rgba(0,0,0,0.3);
}

.service-icon { 
    font-size: 2rem; color: var(--accent); margin-bottom: 20px; 
    display: inline-block; transition: 0.3s;
}
.service-card:hover .service-icon { transform: scale(1.1); text-shadow: 0 0 15px var(--accent-glow); }

.service-card h3 { font-size: 1.25rem; margin-bottom: 12px; color: var(--text-main); font-weight: 600; }
.service-card p { color: var(--text-secondary); font-size: 0.95rem; margin-bottom: 24px; line-height: 1.6; }

.service-link {
    font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent);
    text-transform: uppercase; font-weight: 600; display: flex; align-items: center; gap: 8px;
}
.service-link i { transition: 0.3s; font-size: 0.7em; }
.service-card:hover .service-link i { transform: translateX(4px); }

/* Blog Section */
.blog-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--space-md); }

.blog-item { 
    background: var(--surface-1); border-radius: var(--radius-md); overflow: hidden; 
    border: 1px solid var(--border-light); transition: var(--transition-smooth); 
}
.blog-item:hover { border-color: var(--border-hover); transform: translateY(-6px); }

.blog-img-wrapper { position: relative; height: 200px; overflow: hidden; }
.blog-img-wrapper img { width: 100%; height: 100%; object-fit: cover; transition: 0.6s; opacity: 0.9; }
.blog-item:hover img { transform: scale(1.05); opacity: 1; }

.blog-content { padding: 24px; }
.blog-tag { 
    font-size: 0.7rem; color: var(--accent); border: 1px solid var(--accent); 
    padding: 4px 8px; border-radius: var(--radius-sm);
    display: inline-block; margin-bottom: 12px; 
    text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600;
}
.blog-title { font-size: 1.2rem; color: var(--text-main); margin-bottom: 10px; font-weight: 700; }
.blog-excerpt { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 20px; line-height: 1.5; }

/* Contact Section */
.contact-layout { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-lg); align-items: start; }

.contact-form-box {
    background: var(--surface-2); padding: 40px; border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    position: relative;
}
/* HUD corners simplified */
.hud-corner { position: absolute; width: 10px; height: 10px; border: 2px solid var(--accent); opacity: 0.5; }
.tl { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.tr { top: -1px; right: -1px; border-left: 0; border-bottom: 0; }
.bl { bottom: -1px; left: -1px; border-right: 0; border-top: 0; }
.br { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.input-group { margin-bottom: 20px; }
.input-group label { display: block; font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }

.form-control {
    width: 100%; background: rgba(0,0,0,0.2); border: 1px solid var(--border-light);
    padding: 14px; color: var(--text-main); font-family: var(--font-mono); font-size: 0.9rem;
    border-radius: var(--radius-sm); transition: 0.2s;
}
.form-control:focus { 
    border-color: var(--accent); background: rgba(255, 193, 7, 0.05); 
    box-shadow: 0 0 0 4px var(--accent-glow);
    outline: none;
}

.contact-info-item { display: flex; align-items: flex-start; gap: 20px; margin-bottom: 30px; }
.contact-icon { 
    width: 40px; height: 40px; background: var(--surface-3); 
    border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center;
    color: var(--accent); font-size: 1.1rem; flex-shrink: 0;
}

/* --- MODALS --- */
.modal-backdrop {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); backdrop-filter: blur(5px);
    z-index: 5000; display: flex; justify-content: center; align-items: center;
    opacity: 0; pointer-events: none; transition: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-backdrop.active { opacity: 1; pointer-events: all; }

.modal-content {
    background: var(--surface-3); width: 90%; max-width: 500px; padding: 40px;
    border-radius: var(--radius-md); border: 1px solid var(--border-light);
    position: relative; transform: translateY(30px); transition: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}
.modal-backdrop.active .modal-content { transform: translateY(0); }

.close-modal { position: absolute; top: 20px; right: 20px; font-size: 1.5rem; cursor: pointer; color: var(--text-tertiary); transition: 0.2s; }
.close-modal:hover { color: var(--text-main); }

/* Calc Styles */
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin: 20px 0; }
.calc-display {
    background: rgba(0,0,0,0.3); border: 1px solid var(--border-light); padding: 15px; border-radius: var(--radius-sm);
    margin-top: 20px; text-align: center;
}
.calc-value { font-size: 2rem; color: var(--success); font-family: var(--font-mono); display: block; }

/* --- LOADER --- */
#loader {
    position: fixed; inset: 0; background: var(--bg-dark); z-index: 9999;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    transition: opacity 0.5s ease-out;
}
.spinner {
    width: 40px; height: 40px; border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--accent); border-radius: 50%;
    animation: spin 1s linear infinite; margin-bottom: 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.whatsapp-btn:hover { filter: brightness(0.9); box-shadow: 0 4px 20px rgba(0,0,0,0.5); transform: translateY(-3px); }

/* --- MOBILE NAV --- */
.mobile-nav {
    display: none; position: fixed; bottom: 0; left: 0; width: 100%;
    background: rgba(11, 15, 20, 0.95); backdrop-filter: blur(15px);
    border-top: 1px solid var(--border-light); z-index: 2000;
    justify-content: space-around; padding: 12px 0; padding-bottom: max(12px, env(safe-area-inset-bottom));
}
.mob-link { color: var(--text-secondary); font-size: 1.2rem; padding: 10px; transition: 0.3s; }
.mob-link.active, .mob-link:hover { color: var(--accent); transform: translateY(-2px); }

/* --- MEDIA QUERIES --- */
@media (max-width: 900px) {
    .contact-layout { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .eng-sidebar { display: none; }
    .eng-wrapper { margin-left: 0; }
    .mobile-nav { display: flex; }
    .hero h1 { font-size: 3rem; }
    .section { padding: var(--space-lg) 0; padding-bottom: 100px; } 
}

/* Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *, ::before, ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .scada-wave, .spinner, .scroll-down, #cursor-dot, #cursor-ring { display: none !important; }
}