/* ==========================================================================
   APEDT — Estilos globales (variables, reset, header, footer, utilidades)
   ========================================================================== */

:root {
  --navy: #0E2A47;
  --navy-light: #16385c;
  --navy-dark: #081b30;
  --green: #3C8C3C;
  --green-light: #4fae4f;
  --green-dark: #2c6b2c;
  --white: #ffffff;
  --cream: #F5F7F5;
  --cream-warm: #F1ECDF;
  --gray-100: #f2f4f3;
  --gray-300: #d7dcda;
  --gray-500: #8a9490;
  --gray-700: #4a5652;
  --text-main: #1c2b26;
  --shadow-sm: 0 2px 8px rgba(14, 42, 71, 0.08);
  --shadow-md: 0 8px 24px rgba(14, 42, 71, 0.12);
  --shadow-lg: 0 20px 48px rgba(14, 42, 71, 0.18);
  --radius: 12px;
  --header-height: 108px;
  --header-height-scrolled: 82px;
  --container-width: 1200px;
  --transition: 0.25s ease;
  --font: "Montserrat", -apple-system, BlinkMacSystemFont, Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-weight: 600;
  color: var(--text-main);
  background: var(--white);
  line-height: 1.65;
  font-size: 16.5px;
  -webkit-font-smoothing: antialiased;
  padding-top: var(--header-height);
}

img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
h1, h2, h3, h4 { font-family: var(--font); line-height: 1.15; font-weight: 900; letter-spacing: -0.01em; color: var(--navy); }

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

section { padding: 96px 0; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--green);
  text-transform: uppercase;
  margin-bottom: 16px;
}
.eyebrow::before {
  content: "";
  width: 28px;
  height: 2px;
  background: var(--green);
  display: inline-block;
}

.section-heading { text-align: center; max-width: 680px; margin: 0 auto 56px; }
.section-heading h2 { font-size: clamp(2rem, 3.4vw, 2.75rem); }
.section-heading p { color: var(--gray-700); margin-top: 14px; font-size: 1.08rem; font-weight: 600; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.86rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
  transition: all var(--transition);
}
.btn-solid { background: var(--green); color: var(--white); }
.btn-solid:hover { background: var(--green-dark); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-outline { border: 2px solid var(--navy); color: var(--navy); }
.btn-outline:hover { background: var(--navy); color: var(--white); }
.btn-white { background: var(--white); color: var(--navy); }
.btn-white:hover { background: var(--green); color: var(--white); }
.btn-pastel { background: #A8E0AE; color: var(--navy-dark); }
.btn-pastel:hover { background: #ffffff; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-lg { padding: 16px 34px; font-size: 0.9rem; }

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: var(--white);
  box-shadow: var(--shadow-sm);
  height: var(--header-height);
  display: flex;
  align-items: center;
  transition: height var(--transition);
}
.site-header.scrolled { height: var(--header-height-scrolled); }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.logo { display: flex; align-items: center; }
.logo-img { height: 72px; width: auto; display: block; }

.main-nav ul { display: flex; align-items: center; gap: 22px; }
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--navy);
  padding: 10px 2px;
  white-space: nowrap;
  position: relative;
}
.nav-link::after {
  content: "";
  position: absolute;
  left: 0; bottom: 2px;
  width: 0; height: 2px;
  background: var(--green);
  transition: width var(--transition);
}
.nav-link:hover, .nav-link.active { color: var(--green); }
.nav-link:hover::after, .nav-link.active::after { width: 100%; }
.caret { width: 10px; height: 10px; transition: transform var(--transition); }

.has-submenu { position: relative; }
.submenu {
  position: absolute;
  top: calc(100% + 14px);
  left: 0;
  background: var(--white);
  min-width: 260px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 10px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all var(--transition);
  border-top: 3px solid var(--green);
}
.has-submenu:hover .submenu {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.has-submenu:hover .caret { transform: rotate(180deg); }
.submenu li a {
  display: block;
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
  transition: all var(--transition);
}
.submenu li a:hover { background: var(--cream); color: var(--green); padding-left: 20px; }
.submenu li a.active { background: var(--cream); color: var(--green); font-weight: 800; }

.header-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.header-actions .btn { padding: 12px 20px; font-size: 0.76rem; }

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
}
.hamburger span {
  width: 24px;
  height: 2px;
  background: var(--navy);
  transition: all var(--transition);
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer { background: var(--navy); color: rgba(255,255,255,0.85); padding-top: 72px; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 56px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.footer-col h4 {
  color: var(--white);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 20px;
}
.footer-brand p { font-size: 0.9rem; margin: 14px 0 20px; color: rgba(255,255,255,0.65); max-width: 320px; }
.logo-footer {
  display: inline-flex;
  background: var(--white);
  border-radius: 14px;
  padding: 12px 18px;
}
.logo-footer .logo-img { height: 88px; }

.social-icons { display: flex; gap: 10px; }
.social-icons a {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
  color: var(--white);
  transition: all var(--transition);
}
.social-icons a:hover { background: var(--green); transform: translateY(-3px); }

.footer-contact li { display: flex; align-items: flex-start; gap: 10px; font-size: 0.88rem; margin-bottom: 14px; color: rgba(255,255,255,0.75); }
.footer-contact li i { color: var(--green-light); margin-top: 3px; }

.footer-links li { margin-bottom: 12px; }
.footer-links a { font-size: 0.88rem; color: rgba(255,255,255,0.75); transition: color var(--transition); }
.footer-links a:hover { color: var(--green-light); padding-left: 4px; }

.footer-bottom-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 0;
  flex-wrap: wrap;
  gap: 10px;
}
.footer-bottom-inner p { font-size: 0.8rem; color: rgba(255,255,255,0.6); }
.footer-legal { display: flex; gap: 10px; }
.footer-legal a:hover { color: var(--green-light); }

/* Floating buttons */
.whatsapp-float {
  position: fixed;
  bottom: 26px;
  right: 26px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
  z-index: 900;
  transition: transform var(--transition);
}
.whatsapp-float:hover { transform: scale(1.08); }

.back-to-top {
  position: fixed;
  bottom: 26px;
  right: 96px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all var(--transition);
  z-index: 900;
}
.back-to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { background: var(--green); }

/* ==========================================================================
   Scroll reveal (utilidad reutilizable en páginas interiores)
   ========================================================================== */
.reveal {
  opacity: 0;
  transform: translateY(34px);
  transition: opacity 0.8s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.reveal.revealed { opacity: 1; transform: translateY(0); }
.reveal-delay-1.revealed { transition-delay: 0.1s; }
.reveal-delay-2.revealed { transition-delay: 0.2s; }
.reveal-delay-3.revealed { transition-delay: 0.3s; }
.reveal-delay-4.revealed { transition-delay: 0.4s; }
.reveal-from-left { transform: translateX(-40px); }
.reveal-from-left.revealed { transform: translateX(0); }
.reveal-from-right { transform: translateX(40px); }
.reveal-from-right.revealed { transform: translateX(0); }

@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal-from-left, .reveal-from-right { opacity: 1; transform: none; transition: none; }
}

/* ==========================================================================
   Contadores (reutilizable en Inicio, Servicios y otras páginas)
   ========================================================================== */
.stats {
  background: var(--navy);
  color: var(--white);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  text-align: center;
}
.stat-item .stat-number {
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  font-weight: 900;
  color: var(--green-light);
}
.stat-item .stat-label {
  margin-top: 8px;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.75);
  text-transform: uppercase;
}
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: 1fr; gap: 28px; }
}

/* ==========================================================================
   Tarjetas de noticias y link con flecha (reutilizable en Inicio y Noticias)
   ========================================================================== */
.service-link { color: var(--green); font-weight: 800; font-size: 0.82rem; display: inline-flex; align-items: center; gap: 6px; }
.service-link i { transition: transform var(--transition); }

.news-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}
.news-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}
.news-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-6px); }
.news-card:hover .service-link i { transform: translateX(4px); }
.news-img { position: relative; aspect-ratio: 16/10; overflow: hidden; }
.news-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.news-card:hover .news-img img { transform: scale(1.08); }
.news-tag {
  position: absolute;
  top: 14px; left: 14px;
  background: var(--green);
  color: var(--white);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 5px 12px;
  border-radius: 999px;
  text-transform: uppercase;
}
.news-body { padding: 24px; }
.news-date { font-size: 0.78rem; color: var(--gray-500); display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.news-body h3 { font-size: 1.08rem; margin-bottom: 10px; }
.news-body p { color: var(--gray-700); font-size: 0.88rem; margin-bottom: 16px; }
.news-body .service-link { font-size: 0.8rem; }

@media (max-width: 900px) {
  .news-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Newsletter (reutilizable en Inicio y Noticias)
   ========================================================================== */
.newsletter {
  background: linear-gradient(120deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: var(--white);
  text-align: center;
}
.newsletter h2 { color: var(--white); font-size: clamp(1.6rem, 3vw, 2.1rem); margin-bottom: 12px; }
.newsletter p { color: rgba(255,255,255,0.75); margin-bottom: 32px; }
.newsletter-form {
  display: flex;
  max-width: 460px;
  margin: 0 auto;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.newsletter-form input {
  flex: 1;
  min-width: 240px;
  padding: 15px 20px;
  border-radius: 999px;
  border: none;
  font-size: 0.9rem;
  font-family: var(--font);
  outline: none;
}
.newsletter-form .btn { flex-shrink: 0; }
.newsletter-msg { margin-top: 16px; font-size: 0.85rem; color: var(--green-light); min-height: 20px; }

@media (max-width: 600px) {
  .newsletter-form { flex-direction: column; }
  .newsletter-form input, .newsletter-form .btn { width: 100%; }
}

/* ==========================================================================
   Campos de formulario (reutilizable en Asociados y Contacto)
   ========================================================================== */
.form-field { display: flex; flex-direction: column; gap: 8px; }
.form-field.span-2 { grid-column: span 2; }
.form-field label { font-size: 0.8rem; font-weight: 700; color: var(--navy); }
.form-field input,
.form-field select,
.form-field textarea {
  padding: 13px 16px;
  border-radius: 10px;
  border: 1px solid var(--gray-300);
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.9rem;
  background: var(--white);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  color: var(--text-main);
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(79, 174, 79, 0.15); }

.char-counter {
  align-self: flex-end;
  font-size: 0.76rem;
  color: var(--gray-500);
  font-weight: 700;
}
.char-counter.limit { color: #c0392b; }

.contact-form-msg { margin-top: 16px; font-size: 0.88rem; font-weight: 700; color: var(--green-dark); min-height: 20px; }

/* ==========================================================================
   Modal "Agenda tu consultoría" (disponible en todas las páginas)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 27, 48, 0.78);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.modal-overlay.open { opacity: 1; visibility: visible; }

.modal-box {
  position: relative;
  background: var(--white);
  border-radius: 24px;
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 44px;
  box-shadow: var(--shadow-lg);
  transform: translateY(24px) scale(0.96);
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.modal-overlay.open .modal-box { transform: translateY(0) scale(1); }

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--cream);
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--green); color: var(--white); transform: rotate(90deg); }

.modal-box h3 { font-size: 1.4rem; padding-right: 34px; margin-bottom: 8px; }
.modal-box .modal-sub { color: var(--gray-700); margin-bottom: 28px; }

.consulta-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 20px; }
.consulta-form-grid textarea { resize: vertical; min-height: 110px; }

@media (max-width: 560px) {
  .modal-box { padding: 32px 24px; }
  .consulta-form-grid { grid-template-columns: 1fr; }
  .consulta-form-grid .form-field.span-2 { grid-column: span 1; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 1220px) {
  .main-nav ul { gap: 16px; }
  .header-actions .btn-outline { display: none; }
}

@media (max-width: 900px) {
  .hamburger { display: flex; }
  .main-nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 100%;
    height: calc(100vh - var(--header-height));
    background: var(--white);
    transform: translateX(-100%);
    transition: transform var(--transition);
    overflow-y: auto;
    padding: 20px 0;
  }
  .main-nav.open { transform: translateX(0); }
  .main-nav ul { flex-direction: column; align-items: stretch; gap: 0; padding: 0 24px; }
  .main-nav ul > li { border-bottom: 1px solid var(--gray-100); }
  .nav-link { padding: 16px 0; justify-content: space-between; width: 100%; }
  .submenu {
    position: static;
    opacity: 1; visibility: visible; transform: none;
    box-shadow: none;
    display: none;
    max-height: 0;
    overflow: hidden;
    padding: 0;
    border-top: none;
  }
  .has-submenu.open .submenu { display: block; max-height: 500px; padding: 6px 0 12px; }
  .has-submenu.open .caret { transform: rotate(180deg); }
  .header-actions .btn-outline { display: none; }
  .btn-solid { padding: 10px 18px; font-size: 0.75rem; }
  .logo-img { height: 52px; }
}

@media (max-width: 560px) {
  section { padding: 64px 0; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom-inner { flex-direction: column; text-align: center; }
}
