/* --- GLOBAL BODY & HTML OVERFLOW FIX --- */
html {
    overflow-x: hidden;
}

body {
    max-width: 100vw;
}

/* --- VARIABLES --- */
:root {
    --primary-blue: #0b2138;
    --secondary-blue: #007bff;
    --light-gray: #f8f8f8;
    --white: #ffffff;
    --text-dark: #333333;
    --text-light: #f4f4f4;
    --whatsapp-green: #25D366;
    --whatsapp-green-dark: #1DA851;
}

/* --- BASIC RESET & GENERAL STYLES --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--white);
}

a {
    text-decoration: none;
    color: var(--secondary-blue);
}

a:hover {
    color: var(--primary-blue);
}

h1, h2, h3 {
    margin-bottom: 0.5em;
    color: var(--primary-blue);
    line-height: 1.2;
}

h1 { font-size: 3em; }
h2 { font-size: 2.5em; }
h3 { font-size: 1.8em; }

p {
    margin-bottom: 1em;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 4px;
}

.section-padded {
    padding: 80px 0;
}

.bg-light-gray {
    background-color: var(--light-gray);
}

.bg-dark-blue {
    background-color: var(--primary-blue);
}

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

.btn {
    display: inline-block;
    background-color: var(--secondary-blue);
    color: var(--white);
    padding: 12px 25px;
    border-radius: 5px;
    transition: background-color 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 1em;
}

.btn:hover {
    background-color: #0056b3;
}

/* --- HEADER & NAVIGATION --- */
.main-header {
    background-color: var(--white);
    padding: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 1000;
    min-height: 60px;
    will-change: transform;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    min-height: 60px;
}

.logo {
    display: flex;
    align-items: center;
    color: var(--primary-blue);
    font-size: 1.5em;
    font-weight: bold;
}

.logo img {
    height: 80px;
    margin-right: 0;
    margin-top: -20px;
    margin-bottom: -20px;
    display: block;
}

.nav-links {
    list-style: none;
    display: flex;
}

.nav-links li {
    margin-left: 30px;
}

.nav-links a {
    color: var(--primary-blue);
    font-weight: 600;
    transition: color 0.3s ease;
}

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

.hamburger {
    display: none;
    cursor: pointer;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 20px;
}

.hamburger .bar {
    height: 3px;
    width: 100%;
    background-color: var(--primary-blue);
    border-radius: 10px;
    transition: all 0.3s ease;
}

/* --- HERO SECTION --- */
.hero-section {
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--white);
    min-height: 500px;
    position: relative;
    padding: 0;
}

/* --- FIX FOR iOS BACKGROUND-ATTACHMENT BUG --- */
/* This rule targets only devices where the JS has added the 'ios-device' class */
.ios-device .hero-section {
    background-attachment: scroll;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    align-items: flex-start;
    max-width: 600px;
    width: 100%;
    margin-top: -80px;
    margin-bottom: 0;
    padding: 0 20px;
    box-sizing: border-box;
}

.hero-content h1 {
    font-size: 4em;
    margin-bottom: 10px;
    color: var(--white);
}

.hero-content p {
    font-size: 1.5em;
    color: var(--white);
}

.hero-btn {
    background: transparent;
    color: var(--white);
    border: 1px solid var(--white);
    font-weight: normal;
    transition: background 0.3s, color 0.3s, border-color 0.3s;
    margin-top: 20px;
    border-radius: 999px;
    padding: 12px 38px;
    font-size: 1.1em;
}
.hero-btn:hover {
    background: rgba(255,255,255,0.12);
    color: var(--secondary-blue);
    border-color: var(--secondary-blue);
}

/* --- Toggable Content Buttons --- */
.btn-diferencia {
    background: transparent;
    color: var(--primary-blue);
    border: 1px solid var(--primary-blue);
    padding: 10px 20px;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-top: 1.5em;
    font-size: 0.9em;
}

.btn-diferencia:hover {
    background: rgba(11, 33, 56, 0.07);
    border-color: var(--secondary-blue);
    color: var(--secondary-blue);
}

.btn-gestion {
    display: inline-block;
    background: transparent;
    border: 1px solid var(--primary-blue);
    color: var(--primary-blue);
    font-weight: 600;
    cursor: pointer;
    padding: 10px 20px;
    margin-top: 1em;
    font-size: 0.9em;
    border-radius: 999px;
    transition: all 0.3s ease;
}
.btn-gestion:hover {
    background: rgba(11, 33, 56, 0.07);
    color: var(--secondary-blue);
    border-color: var(--secondary-blue);
}

/* Generic Collapsible Content Wrapper */
.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-in-out;
}

.collapsible-content.open {
    max-height: 500px;
}


/* --- ABOUT US (SOBRE NOSOTROS) SECTION --- */
.sobre-nosotros-section {
  position: relative;
  overflow: visible;
  padding-top: 1.2em !important;
  padding-bottom: 1.2em !important;
  min-height: 680px;
  z-index: 1;
}
.sobre-nosotros-bg-oval {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 680px;
  min-height: 680px;
  max-height: none;
  background: #e0ddd6;
  border-bottom-left-radius: 50% 20%;
  border-bottom-right-radius: 50% 20%;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  z-index: 0;
  pointer-events: none;
  overflow-x: hidden;
}
.sobre-nosotros-section .container {
  position: relative;
  z-index: 2;
}
.sobre-nosotros-flex {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 60px;
  width: 100%;
}
.sobre-nosotros-col-img {
  flex: 0 0 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  margin-top: 8.5em;
}
.sobre-nosotros-img-ml {
  width: 100%;
  max-width: 260px;
  border-radius: 12px;
  object-fit: cover;
  display: block;
}
.sobre-nosotros-tercero {
  font-size: 0.85em;
  color: #555;
  margin-top: 2.2em;
  text-align: center;
  display: block;
}

.sobre-nosotros-col-text {
  flex: 1 1 0%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  min-width: 0;
}
.sobre-nosotros-col-text h2 {
  font-size: 2.2em;
  margin-top: 0.5em;
  margin-bottom: 0.7em;
  display: block;
  font-weight: 700;
}
.sobre-nosotros-principal {
  font-size: 1.08em;
  margin-bottom: 1.6em;
  display: block;
}
.sobre-nosotros-secundario {
  font-size: 0.98em;
  margin-top: 2.2em;
  margin-left: 2.5em;
  width: 85%;
  display: block;
  text-align: left;
}
.gestion-parrafo-oculto {
    text-align: justify;
    text-justify: inter-word;
    margin-top: 1.5em;
}


@media (max-width: 600px) {
  .sobre-nosotros-section {
    position: relative !important;
    overflow: hidden !important;
    padding-top: 5em !important;
    min-height: 480px !important;
    z-index: 1;
  }
  .sobre-nosotros-nombre {
    margin-bottom: 0.2em !important;
  }
  .sobre-nosotros-tercero {
    margin-top: 0.2em !important;
  }
}

@media (max-width: 900px) {
  .sobre-nosotros-principal,
  #que-hacemos .section-description,
  #que-hacemos .grid-item p {
    font-size: 0.85em;
  }
  
  .btn-diferencia {
      align-self: center;
      margin-top: 1em;
  }

  .contact-grid, .contact-form {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }
  .perfil-btn {
    margin-top: 0.7em !important;
    margin-bottom: 0.7em !important;
  }
  .sobre-nosotros-flex {
    flex-direction: column;
    gap: 0;
    align-items: center;
  }
  .sobre-nosotros-col-img {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 0 !important;
    margin-bottom: 1.2em;
    width: 100%;
  }
  .sobre-nosotros-img-ml {
    width: 100%;
    max-width: 350px;
    height: auto;
    display: block;
    border-radius: 12px;
    object-fit: cover;
  }

  .sobre-nosotros-col-text {
    align-items: flex-start;
    width: 100%;
    padding: 0 15px;
    box-sizing: border-box;
  }
  
  .sobre-nosotros-section {
    padding-top: 5em;
    padding-bottom: 3em; 
    min-height: 480px;
    z-index: 1;
    transition: padding-bottom 0.5s ease-in-out;
  }
  .sobre-nosotros-section.expanded {
    padding-bottom: 7em;
  }
  
  .sobre-nosotros-col-text h2 {
    margin-top: 0.5em !important;
  }
}

@media (max-width: 900px) {
  .sobre-nosotros-bg-oval {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    background: #e0ddd6;
    z-index: 0;
    pointer-events: none;
    display: block;
    height: 100%;
    width: 100vw;
    min-width: 100vw;
    max-width: 100vw;
    border-bottom-left-radius: 50% 5em;
    border-bottom-right-radius: 50% 5em;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }
}

@media (max-width: 900px) and (hover: none) and (pointer: coarse) {
  @supports (-webkit-touch-callout: none) {
    .sobre-nosotros-bg-oval {
      width: 100vw !important;
      min-width: 100vw !important;
      max-width: 100vw !important;
      border-bottom-left-radius: 50% 5em !important;
      border-bottom-right-radius: 50% 5em !important;
    }
    html {
      font-size: 13px !important;
    }
  }
}

/* --- MODAL PERFIL FUNDADOR --- */
@media (min-width: 901px) {
  .modal-perfil-content {
    position: relative;
    left: -80px;
  }
}
.perfil-btn {
  color: var(--primary-blue) !important;
  border: 1px solid var(--primary-blue) !important;
  background: transparent !important;
  font-weight: 600;
  transition: background 0.3s, color 0.3s, border-color 0.3s;
}
.perfil-btn:hover {
  background: rgba(11,33,56,0.07) !important;
  color: var(--secondary-blue) !important;
  border-color: var(--secondary-blue) !important;
}
.modal-perfil {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.45);
  justify-content: center;
  align-items: flex-start;
  padding-top: 9vh;
  transition: opacity 0.2s;
}
.modal-perfil-content {
  background: #fff;
  border-radius: 16px;
  padding: 2.2em 1.5em 1.5em 1.5em;
  max-width: 340px;
  width: 92vw;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  text-align: center;
  position: relative;
  animation: modalPerfilFadeIn 0.2s;
}
.modal-perfil-cerrar {
  position: absolute;
  top: 12px;
  right: 18px;
  font-size: 2em;
  color: #888;
  cursor: pointer;
  font-weight: bold;
  transition: color 0.2s;
}
.modal-perfil-cerrar:hover {
  color: #007bff;
}
.modal-perfil-img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1em;
}
@keyframes modalPerfilFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}


/* --- LAYOUT & COMPONENTS --- */
.image-overlay-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.image-overlay-wrapper img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(11, 33, 56, 0.7);
    border-radius: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-overlay-wrapper:hover .image-overlay {
    opacity: 1;
}

.grid-2-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
    margin-top: 30px;
    text-align: center;
}

.grid-item {
    background-color: var(--white);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.grid-item h3 {
    margin-top: 20px;
    font-size: 1.5em;
    color: var(--primary-blue);
}

/* --- Contact Section Styles --- */
/* CORRECTED RULE to reduce top padding for the Contacto section */
#contacto.section-padded {
    padding-top: 40px !important;
}

.contact-intro-text {
    margin-bottom: 1.5em;
    text-align: left;
}

.btn-whatsapp {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--whatsapp-green);
    color: var(--white);
    padding: 12px 25px;
    border-radius: 5px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.btn-whatsapp:hover {
    background-color: var(--whatsapp-green-dark);
    color: var(--white);
}

.btn-whatsapp i {
    font-size: 1.2em;
    margin-right: 10px;
}

.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
    margin-top: 40px;
}

.contact-form {
    margin-top: 2em;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--white);
    border-radius: 5px;
    font-size: 1em;
}

.contact-form input::placeholder,
.contact-form textarea::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.contact-form textarea {
    resize: vertical;
}

.contact-info-area p {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.contact-info-area p i {
    margin-right: 10px;
    color: var(--secondary-blue);
    font-size: 1.2em;
}

.social-links {
    margin-top: 20px;
    margin-bottom: 30px;
}

.social-links a {
    display: inline-block;
    color: var(--white);
    font-size: 1.8em;
    margin-right: 20px;
    transition: color 0.3s ease;
}

.social-links a:hover {
    color: var(--secondary-blue);
}

.main-footer {
    background-color: #222;
    color: var(--white);
    text-align: center;
    padding: 30px 0;
    font-size: 0.9em;
}
.footer-social {
    margin-bottom: 10px;
}
.footer-social a {
    color: var(--white);
    font-size: 1.5em;
    margin: 0 10px;
    transition: color 0.3s;
}
.footer-social a:hover {
    color: var(--secondary-blue);
}
.main-footer p {
    margin-top: 10px;
    font-size: 0.95em;
}


/* --- RESPONSIVENESS (MEDIA QUERIES) --- */
@media (max-width: 1200px) {
  /* No specific changes here. */
}

@media (max-width: 768px) {
  .hero-section {
    min-height: 100vh;
    padding: 0;
  }
  .hero-content {
    text-align: left;
    align-items: flex-start;
    margin-left: 0;
    max-width: 100%;
    padding-left: 0;
    margin-top: -180px !important;
  }
  .hero-content h1 {
    font-size: 1.5em;
  }
  .hero-content p,
  .hero-content .hero-subtitle {
    font-size: 1.em;
  }
  .hero-btn {
    padding: 7px 22px;
    font-size: 0.95em;
    margin-top: 14px;
  }

  .navbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .nav-links {
    display: none;
    flex-direction: column;
    width: 100%;
    margin-top: 15px;
    text-align: center;
    background-color: var(--white);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: absolute;
    top: 70px;
    left: 0;
    padding-bottom: 10px;
  }
  .nav-links.active {
    display: flex;
  }
  .nav-links li {
    margin: 10px 0;
    width: 100%;
    padding: 5px 0;
  }
  .nav-links a {
    display: block;
  }
  .hamburger {
    display: flex;
    position: absolute;
    right: 20px;
    top: 25px;
  }

  h2 { font-size: 1.3em; }
  h3 { font-size: 1.1em; }
  p, .section-description { font-size: 0.98em; }

  .content-wrapper {
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  .content-wrapper .text-content {
    max-width: 100%;
    padding-left: 12px;
    padding-right: 12px;
    box-sizing: border-box;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  .grid-2-columns,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .section-padded {
    padding: 60px 0;
  }
}

/* Animation Hamburger (optional, for JS) */
.hamburger.open .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
.hamburger.open .bar:nth-child(2) {
    opacity: 0;
}
.hamburger.open .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* --- Animate on Scroll Styles --- */
.fade-in-element {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

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

/* Optional: Add a slight delay to even-numbered items in a grid for a staggered effect */
.grid-2-columns .fade-in-element:nth-child(even),
.contact-grid .fade-in-element:nth-child(even) {
    transition-delay: 0.2s;
}