/* ==========================================================================
   1. ARQUITECTURA DE VARIABLES CSS Y THEMING
   ========================================================================== */
:root {
    /* MODO OSCURO (Activado por JS) */
    --bg-base: #050505;
    --bg-surface: #111111;
    --bg-surface-hover: #161616;
    --text-main: #ffffff;
    --text-muted: #8e8e93;
    --text-logo: #ffffff; 
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.15);
    --glass-bg: rgba(17, 17, 17, 0.6);
    --shadow-subtle: 0 20px 40px rgba(0,0,0,0.6);
    
    --primary: #3aa935;
    --primary-glow: rgba(58, 169, 53, 0.35);
    
    --font-main: 'Inter', sans-serif;
    --font-title: 'Urbanist', sans-serif;
    --radius-lg: 24px;
    --radius-md: 14px;
    --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
    /* MODO CLARO (Activado por Defecto) */
    --bg-base: #fafafa;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f4f4f6;
    --text-main: #1c1c1e;
    --text-muted: #68686e;
    --text-logo: #1c1c1e;
    --border: rgba(0, 0, 0, 0.08);
    --border-strong: rgba(0, 0, 0, 0.15);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --shadow-subtle: 0 20px 40px rgba(0,0,0,0.06);
    --primary-glow: rgba(58, 169, 53, 0.15);
}

/* ==========================================================================
   2. RESETS GLOBALES Y TIPOGRAFÍA
   ========================================================================== */
* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

html { 
    scroll-behavior: smooth; 
    scroll-padding-top: 120px; /* Compensación del Navbar fijo */
}

body {
    font-family: var(--font-main); 
    background-color: var(--bg-base);
    color: var(--text-main); 
    line-height: 1.6; 
    overflow-x: hidden;
    transition: background-color 0.4s ease, color 0.4s ease;
    background-image: 
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 50px 50px; 
    background-position: center top;
}

.container { 
    width: 100%; 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 0 24px; 
}

.sr-only { 
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; 
}

h2, h3, h4 { 
    font-family: var(--font-title); 
    font-weight: 800; 
    line-height: 1.1; 
    letter-spacing: -0.03em; 
}

.text-gradient { 
    background: linear-gradient(135deg, var(--text-main) 30%, var(--primary) 100%); 
    -webkit-background-clip: text; 
    -webkit-text-fill-color: transparent; 
    background-clip: text; 
}

.ambient-glow { 
    position: absolute; top: -15%; left: 50%; transform: translateX(-50%); width: 75vw; height: 50vh; 
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 65%); 
    z-index: -1; filter: blur(70px); opacity: 0.8; pointer-events: none; transition: background 0.4s ease; 
}

/* ==========================================================================
   3. BOTONES (UI COMPONENTS)
   ========================================================================== */
.btn { 
    display: inline-flex; align-items: center; justify-content: center; padding: 14px 30px; font-weight: 600; 
    border-radius: 100px; text-decoration: none; transition: var(--transition); border: none; cursor: pointer; 
    gap: 10px; font-size: 0.95rem; 
}
.btn-primary { 
    background-color: var(--primary); color: #fff; box-shadow: 0 10px 25px var(--primary-glow); 
}
.btn-primary:hover { 
    box-shadow: 0 15px 35px rgba(58, 169, 53, 0.6); transform: translateY(-2px); 
}
.btn-outline { 
    background-color: var(--bg-surface); border: 1px solid var(--border-strong); color: var(--text-main); 
}
.btn-outline:hover { 
    background-color: var(--bg-surface-hover); border-color: var(--text-main); 
}
.btn-icon { 
    background: transparent; border: 1px solid var(--border); color: var(--text-main); width: 44px; height: 44px; 
    border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: var(--transition); 
}
.btn-icon:hover { 
    background: var(--bg-surface-hover); transform: scale(1.05); 
}

/* ==========================================================================
   4. NAVBAR Y HEADER
   ========================================================================== */
header { 
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%); width: calc(100% - 48px); max-width: 1200px; 
    background: var(--glass-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); 
    border: 1px solid var(--border); border-radius: 100px; z-index: 1000; transition: var(--transition); 
}
.nav-container { 
    display: flex; justify-content: space-between; align-items: center; padding: 10px 24px; 
}
nav ul { 
    display: flex; list-style: none; gap: 36px; align-items: center; 
}
nav a { 
    text-decoration: none; color: var(--text-muted); font-weight: 600; font-size: 0.95rem; transition: var(--transition); 
}
nav a:hover { 
    color: var(--text-main); 
}

/* --- DROPDOWN WINCHITA --- */
.winchita-horario {
    position: relative; display: flex; align-items: center; gap: 8px;
    background: var(--bg-surface); border: 1px solid var(--border-strong); 
    padding: 8px 16px; border-radius: 100px; font-size: 0.85rem; 
    color: var(--text-main); cursor: pointer; transition: var(--transition);
}
.winchita-horario:hover { 
    border-color: var(--primary); background: var(--bg-surface-hover); 
}

.pulse-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
    background-color: #8e8e93; box-shadow: 0 0 0 0 rgba(142, 142, 147, 0.7);
}
.pulse-dot.open { background-color: #3aa935; animation: pulse-open 2s infinite; }
.pulse-dot.closed { background-color: #ff3b30; animation: pulse-closed 2s infinite; }

.winchita-details {
    position: absolute; top: calc(100% + 15px); right: 0; 
    background: var(--bg-surface); border: 1px solid var(--border-strong);
    border-radius: 16px; padding: 18px; width: max-content;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2); opacity: 0; visibility: hidden;
    transform: translateY(15px); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; flex-direction: column; gap: 8px; font-weight: 500; z-index: 1100;
}
.winchita-content i { transition: transform 0.3s ease; }
.winchita-horario:hover .winchita-details { opacity: 1; visibility: visible; transform: translateY(0); }
.winchita-horario:hover .winchita-content i { transform: rotate(180deg); color: var(--primary); }

/* ==========================================================================
   5. SECCIÓN: HERO
   ========================================================================== */
#home { padding: 180px 0 90px; position: relative; }
.hero-layout { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 50px; align-items: center; }
.hero-content-text { text-align: left; }
.hero-badge { 
    display: inline-block; padding: 6px 16px; background: var(--primary-glow); border: 1px solid rgba(58, 169, 53, 0.25); 
    color: var(--primary); border-radius: 100px; font-size: 0.85rem; font-weight: 700; margin-bottom: 24px; 
    text-transform: uppercase; letter-spacing: 0.05em; 
}
.hero-title-visible { 
    font-family: var(--font-title); font-weight: 900; line-height: 1.05; letter-spacing: -0.04em; 
    font-size: clamp(2.5rem, 4vw, 4rem); margin-bottom: 24px; 
}
.typewriter-container { color: var(--primary); font-weight: 900; position: relative; display: inline-block; }
.cursor { font-weight: 300; animation: blink 0.8s infinite; color: var(--primary); margin-left: 2px; }

.hero-content-text p { font-size: 1.15rem; color: var(--text-muted); margin-bottom: 30px; }
.hero-content-text p strong { color: var(--text-main); font-weight: 600; }
.hero-buttons { display: flex; gap: 16px; flex-wrap: wrap; justify-content: flex-start; }

/* --- HERO SLIDER --- */
.hero-slider-container { width: 100%; position: relative; }
.slider-wrapper { 
    position: relative; width: 100%; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-subtle); 
    border: 1px solid var(--border); aspect-ratio: 4 / 3; background: var(--bg-surface); 
}
.slider-track { display: flex; height: 100%; transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1); }
.slide { min-width: 100%; height: 100%; position: relative; }
.slide img { width: 100%; height: 100%; object-fit: cover; transition: transform 3s ease; }
.slide::after { 
    content: ''; position: absolute; inset: 0; background: radial-gradient(circle, transparent 50%, rgba(0,0,0,0.4) 100%); pointer-events: none; 
}

.slider-btn { 
    position: absolute; top: 50%; transform: translateY(-50%); background: var(--glass-bg); backdrop-filter: blur(10px); 
    border: 1px solid var(--border-strong); color: var(--text-main); width: 48px; height: 48px; border-radius: 50%; 
    cursor: pointer; display: flex; align-items: center; justify-content: center; transition: var(--transition); z-index: 10; font-size: 1.1rem; 
}
.slider-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); transform: translateY(-50%) scale(1.1); }
.slider-prev { left: 16px; }
.slider-next { right: 16px; }

.slider-dots { 
    position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; z-index: 10; 
    background: rgba(0,0,0,0.5); backdrop-filter: blur(5px); padding: 8px 14px; border-radius: 100px; border: 1px solid rgba(255,255,255,0.1); 
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.5); cursor: pointer; transition: var(--transition); }
.dot.active { background: var(--primary); transform: scale(1.3); box-shadow: 0 0 10px var(--primary); }

/* ==========================================================================
   6. SECCIÓN: CONFIANZA / CHILEPROVEEDORES
   ========================================================================== */
#confianza { padding: 40px 0 60px; }
.trust-banner { 
    background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 35px 45px; 
    display: flex; align-items: center; gap: 40px; box-shadow: var(--shadow-subtle); transition: var(--transition); 
}
.trust-banner:hover { border-color: rgba(58, 169, 53, 0.3); }
.trust-logo-box { flex-shrink: 0; width: 140px; text-align: center; color: #1e4b8f; }
.trust-logo-box svg { width: 100%; max-width: 125px; height: auto; }
.trust-text-box h3 { font-size: 1.75rem; margin-bottom: 8px; color: var(--text-main); }
.trust-text-box p { color: var(--text-muted); font-size: 1rem; margin: 0; }

/* ==========================================================================
   7. SECCIÓN: SERVICIOS (BENTO GRID)
   ========================================================================== */
section.bento-section { padding: 60px 0 90px; }
.section-header { text-align: center; margin-bottom: 65px; }
.section-header h2 { font-size: 3.2rem; margin-bottom: 16px; }
.section-header p { font-size: 1.15rem; color: var(--text-muted); max-width: 650px; margin: 0 auto; }

.bento-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; } /* Unificado */
.bento-card { 
    background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 40px; 
    display: flex; flex-direction: column; justify-content: space-between; min-height: 290px; box-shadow: var(--shadow-subtle); transition: var(--transition); 
}
.bento-card:hover { border-color: var(--primary); transform: translateY(-4px); }
.bento-large { grid-column: span 2; }

.bento-card i { color: var(--primary); font-size: 2.5rem; margin-bottom: 24px; display: block; }
.bento-card h3 { font-size: 1.65rem; margin-bottom: 12px; color: var(--text-main); }
.bento-card p { color: var(--text-muted); font-size: 0.98rem; margin: 0; }

/* ==========================================================================
   8. SECCIÓN: QUIÉNES SOMOS & FLIP CARDS
   ========================================================================== */
#quienes-somos {
    margin: 40px 0; padding: 100px 0;
    background: linear-gradient(90deg, var(--bg-base) 0%, var(--bg-surface) 50%, var(--bg-base) 100%);
    border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.about-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 70px; align-items: start; }

.about-text .about-tag {
    display: inline-block; font-size: 0.72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
    color: var(--primary); background: var(--primary-glow); border: 1px solid rgba(58,169,53,.25);
    padding: 4px 14px; border-radius: 20px; margin-bottom: 20px;
}
.about-text h2 { font-size: clamp(2rem, 3.5vw, 2.9rem); font-family: var(--font-title); font-weight: 900; line-height: 1.05; margin-bottom: 28px; }
.about-text h2 em { font-style: normal; color: var(--primary); }
.about-text .about-lead {
    font-size: 1.05rem; line-height: 1.75; color: var(--text-main); font-weight: 500;
    border-left: 3px solid var(--primary); padding-left: 18px; margin-bottom: 22px;
}
.about-text .about-body { font-size: 0.98rem; line-height: 1.75; color: var(--text-muted); margin-bottom: 18px; }
.about-text .about-body strong { color: var(--text-main); font-weight: 600; }
.about-cta { margin-top: 32px; }

/* --- FLIP CARDS --- */
.flip-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.flip-card { height: 210px; perspective: 1000px; cursor: default; }
.flip-inner {
    position: relative; width: 100%; height: 100%; transition: transform 0.65s cubic-bezier(0.4, 0, 0.2, 1); transform-style: preserve-3d;
}
.flip-card:hover .flip-inner { transform: rotateY(180deg); }

.flip-front, .flip-back {
    position: absolute; inset: 0; border-radius: var(--radius-md); backface-visibility: hidden; -webkit-backface-visibility: hidden;
    display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px 20px; text-align: center; border: 1px solid var(--border); transition: border-color 0.3s;
}
.flip-front { background: var(--bg-surface); }
.flip-card:hover .flip-front { border-color: var(--primary); }
.flip-back { background: var(--primary); transform: rotateY(180deg); border-color: transparent; }

.flip-front .flip-value { font-family: var(--font-title); font-weight: 900; font-size: 3rem; color: var(--primary); line-height: 1; margin-bottom: 8px; letter-spacing: -0.02em; }
.flip-front .flip-label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); }
.flip-front .flip-icon { font-size: 1.6rem; color: var(--primary); margin-bottom: 10px; opacity: 0.6; }
.flip-back .flip-back-title { font-family: var(--font-title); font-weight: 900; font-size: 1.1rem; color: #fff; margin-bottom: 10px; }
.flip-back .flip-back-text { font-size: 0.85rem; color: rgba(255,255,255,0.88); line-height: 1.6; }

/* ==========================================================================
   9. SECCIÓN: GALERÍA INFINITA (MARQUEE)
   ========================================================================== */
.marquee-gallery-section { padding: 20px 0 60px; overflow: hidden; width: 100%; }
.marquee-container { display: flex; flex-direction: column; gap: 16px; width: 100%; }
.marquee-track { display: flex; gap: 16px; width: max-content; animation: scroll-left 40s linear infinite; }
.marquee-track.reverse { animation: scroll-right 40s linear infinite; }
.marquee-track:hover { animation-play-state: paused; }
.marquee-item { 
    width: 280px; height: 190px; border-radius: var(--radius-md); overflow: hidden; flex-shrink: 0; 
    box-shadow: var(--shadow-subtle); border: 1px solid var(--border); background: var(--bg-surface); cursor: default; position: relative; 
}
.marquee-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; filter: brightness(0.9); }
.marquee-item:hover img { transform: scale(1.1); filter: brightness(1); }

/* ==========================================================================
   10. SECCIÓN: CONTACTO Y MAPA
   ========================================================================== */
#contacto { padding: 60px 0; }
.contact-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: start; }
.contact-text h2 { font-size: 3.5rem; margin-bottom: 20px; }
.contact-text p { font-size: 1.1rem; color: var(--text-muted); }

.contact-info-list { margin-top: 45px; }
.contact-item { display: flex; align-items: flex-start; gap: 20px; margin-bottom: 32px; }
.contact-item i { font-size: 24px; color: var(--primary); flex-shrink: 0; margin-top: 4px; }
.contact-item div strong { display: block; color: var(--text-main); font-size: 1.15rem; margin-bottom: 4px; }
.contact-item div span { color: var(--text-muted); font-size: 1rem; }

.form-container { 
    background: var(--bg-surface); padding: 45px; border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-subtle); 
}
.form-group { margin-bottom: 26px; position: relative; }
.form-control { 
    width: 100%; background: transparent; border: none; border-bottom: 1px solid var(--border-strong); 
    padding: 14px 0; color: var(--text-main); font-family: var(--font-main); font-size: 1rem; transition: var(--transition); 
}
.form-control:focus { outline: none; border-bottom-color: var(--primary); }
.form-control::placeholder { color: var(--text-muted); opacity: 0.5; }
textarea.form-control { resize: vertical; min-height: 110px; }
.form-container .btn { width: 100%; margin-top: 12px; padding: 16px; }

/* --- MAPA --- */
.map-section { max-width: 900px; margin: 40px auto 90px; padding: 0 24px; }
.map-wrapper { 
    position: relative; border-radius: var(--radius-lg); border: 1px solid var(--border); overflow: hidden; 
    box-shadow: var(--shadow-subtle); height: 350px; background: var(--bg-surface); 
}
.map-iframe { width: 100%; height: 100%; border: 0; filter: grayscale(100%) contrast(1.2); transition: filter 0.5s var(--transition); }
.map-wrapper:hover .map-iframe { filter: grayscale(0%) contrast(1); }

/* ==========================================================================
   11. FOOTER Y FLOTANTES
   ========================================================================== */
.wa-float { 
    position: fixed; bottom: 35px; right: 35px; background-color: #25D366; color: #fff; width: 60px; height: 60px; 
    border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 12px 24px rgba(37, 211, 102, 0.3); 
    z-index: 1000; transition: var(--transition); text-decoration: none; 
}
.wa-float:hover { transform: scale(1.1); box-shadow: 0 15px 30px rgba(37, 211, 102, 0.5); }
.wa-float i { font-size: 32px; }

footer { padding: 45px 0 30px; text-align: center; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.9rem; }
footer a { color: var(--primary); text-decoration: none; font-weight: 600; transition: var(--transition); }
footer a:hover { color: var(--text-main); }

.appstack-logo { text-decoration: none !important; font-weight: 900; letter-spacing: -0.02em; font-family: var(--font-title); transition: var(--transition); display: inline-block; margin-left: 4px; }
.appstack-logo:hover { transform: scale(1.05); }
.appstack-logo .app { color: var(--text-main); }
.appstack-logo .stack { color: #39ff14; }

.social-links { display: flex; gap: 16px; justify-content: center; margin-bottom: 24px; }
.social-btn { 
    width: 44px; height: 44px; border-radius: 50%; background: var(--bg-surface); border: 1px solid var(--border-strong); 
    display: flex; align-items: center; justify-content: center; color: var(--text-main); font-size: 1.15rem; transition: var(--transition); text-decoration: none; 
}
.social-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); transform: translateY(-4px); box-shadow: 0 10px 20px var(--primary-glow); }

/* ==========================================================================
   12. UTILIDADES Y KEYFRAMES (ANIMACIONES)
   ========================================================================== */
.reveal { opacity: 0; transform: translateY(35px); transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1); }
.reveal.active { opacity: 1; transform: translateY(0); }
.delay-1 { transition-delay: 0.12s; }
.delay-2 { transition-delay: 0.24s; }

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes pulse-open {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(58, 169, 53, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(58, 169, 53, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(58, 169, 53, 0); }
}
@keyframes pulse-closed {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(255, 59, 48, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 59, 48, 0); }
}
@keyframes scroll-left { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }
@keyframes scroll-right { 0% { transform: translateX(-50%); } 100% { transform: translateX(0); } }

/* ==========================================================================
   13. MEDIA QUERIES (RESPONSIVE)
   ========================================================================== */
@media (max-width: 992px) {
    .hero-layout { grid-template-columns: 1fr; text-align: center; gap: 40px; }
    .hero-content-text { display: flex; flex-direction: column; align-items: center; }
    .hero-content-text p { text-align: center; }
    .hero-buttons { justify-content: center; }
    .slider-wrapper { aspect-ratio: 16 / 9; }
    
    .bento-grid { grid-template-columns: 1fr 1fr; }
    .bento-large { grid-column: span 2; }
    
    .about-layout, .contact-layout { grid-template-columns: 1fr; gap: 45px; }
    .flip-grid { grid-template-columns: 1fr 1fr; }
    .flip-card { height: 185px; }
}

@media (max-width: 768px) {
    header { width: 100%; top: 0; border-radius: 0; border-left: none; border-right: none; border-top: none; }
    nav ul.desktop-menu { display: none; }
    .winchita-horario .hide-mobile { display: none; }
    .winchita-horario { padding: 8px 12px; }
    
    .slider-wrapper { aspect-ratio: 4 / 3; }
    
    .bento-grid { grid-template-columns: 1fr; }
    .bento-large { grid-column: span 1; }
    
    .trust-banner { flex-direction: column; text-align: center; gap: 24px; padding: 30px; }
    .trust-logo-box { width: 100px; }
    
    .marquee-item { width: 220px; height: 150px; }
}