:root {
  --primary: #414bb2;
  --primary-900: #1e2a6e;
  --ink: #0f172a;
  --muted: #525a6a;
  --bg: #ffffff;
  --card: #e9eefc;
  --card-ink: #0f1533;
  --white: #fff;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

/* ===== Base ===== */
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial,
    sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
}

.container {
  width: min(1120px, 92vw);
  margin: 0 auto;
}
.container-fluid {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding-left: clamp(16px, 3vw, 28px);
  padding-right: clamp(16px, 3vw, 28px);
}

/* ===== NAV ===== */
.topbar {
  display: flex;
  top: 0;
  z-index: 20;
  justify-self: center;
  width: 95%;
  background: #fff;
  border-bottom: 1px solid #eef0f5;
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
}
.menu {
  display: flex;
  gap: 24px;
  align-items: center;
  margin-left: auto;
}

/* Links del menú */
.menu a:not(.btn) {
  color: #1b2559;
  text-decoration: none;
  font-weight: 600;
}
.menu .btn,
.menu .btn:visited,
.menu .btn:focus,
.menu .btn:active {
  color: #fff !important;
}

/* Logo header (PNG con padding) */
.brand img {
  height: 200px;
  width: auto;
  display: block;
  margin-top: -60px;
  margin-bottom: -70px;
}

/* ===== NAV TOGGLE (look CTA) ===== */
.nav-toggle {
  display: none; /* desktop oculto */
  appearance: none;
  border: 0;
  cursor: pointer;
  height: 44px;
  min-width: 48px;
  padding: 0 14px;
  border-radius: 14px;
  background: #0f1533;
  color: #fff;
  box-shadow: var(--shadow);
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.nav-toggle i {
  pointer-events: none;
}
.nav-toggle:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 700;
  border: 1px solid transparent;
  transition: 0.2s ease-in-out;
  box-shadow: var(--shadow);
}
.btn,
.btn:visited,
.btn:focus,
.btn:active {
  transform: none;
  box-shadow: var(--shadow);
}
.btn-light,
.btn-light:hover,
.btn-light:active,
.btn-light:focus {
  background: var(--primary);
  color: #fff;
  border-color: transparent;
  filter: none;
}
.btn-white,
.btn-white:hover,
.btn-white:active,
.btn-white:focus {
  background: #fff;
  color: #1b2559;
  border-color: #e2e8f0;
  filter: none;
}
.btn-dark,
.btn-dark:hover,
.btn-dark:active,
.btn-dark:focus {
  background: #0f1533;
  color: #fff;
  border-color: transparent;
  filter: none;
}
.menu a .btn-dark {
  color: #fff;
}
.btn:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

/* ===== HERO ===== */
.hero {
  position: relative;
  overflow: hidden;
  min-height: 440px;
}
.hero__bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    rgba(65, 75, 178, 0.95),
    rgba(41, 191, 175, 0.95)
  );
  filter: none;
}
.hero__inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 40px;
  align-items: center;
  padding: 56px 0 64px;
  color: #fff;
}
.hero__copy h1 {
  margin: 0 0 12px;
  font-size: clamp(28px, 4.2vw, 48px);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.hero__copy .lead {
  opacity: 0.95;
  font-size: 18px;
  max-width: 50ch;
}
.hero__media img {
  width: 100%;
  height: auto;
  display: block;
  transform: translateY(8px);
  filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.25));
}
.cta {
  display: flex;
  gap: 14px;
  margin-top: 18px;
}

/* ===== SERVICES ===== */
.services {
  padding: 36px 0 64px;
}
.services h2 {
  font-size: 26px;
  margin: 0 0 14px;
}

.carousel {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
}
.carousel__viewport {
  overflow: hidden;
  /* scroll-behavior: smooth;  <-- REMOVED for infinite JS loop */
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(320px, 80vw);
  gap: 18px;
  padding: 8px 2px;
}
.carousel__arrow {
  appearance: none;
  border: none;
  cursor: pointer;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #f2f4fb;
  color: #1a2452;
  font-size: 28px;
  line-height: 0;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
}
.carousel__arrow:hover {
  background: #e9eefc;
}

.card {
  background: var(--card);
  border-radius: 20px;
  padding: 18px 16px;
  box-shadow: var(--shadow);
  height: 100%;
  display: grid;
  gap: 10px;
  align-content: start;
}
.card__icon {
  width: 84px;
  height: 84px;
  border-radius: 18px;
  background: #fff;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
}
.card__icon img {
  max-width: 56px;
  height: auto;
}
.card h3 {
  margin: 6px 0 0;
  font-size: 16px;
  color: var(--card-ink);
}
.card p {
  margin: 0;
  color: #4a5272;
  font-size: 13px;
}

/* ===== FOOTER ===== */
.site-footer {
  margin-top: 40px;
  position: relative;
  color: #fff;
  width: 100%;
  overflow: hidden;
}
.footer__bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(19, 25, 58, 0.98),
    rgba(14, 18, 44, 0.98)
  );
}
.footer__inner {
  position: relative;
  z-index: 1;
  min-height: 84px;
  padding: 18px clamp(16px, 3vw, 28px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 24px;
  align-items: center;
}
.footer__brand img {
  height: 200px;
  width: auto;
  display: block;
  margin-top: -60px;
  margin-bottom: -70px;
  justify-self: start;
}
.footer__links {
  list-style: none;
  display: flex;
  gap: 22px;
  margin: 0;
  padding: 0;
  justify-self: center;
}
.footer__links a {
  color: #dbe3ff;
  text-decoration: none;
  font-weight: 600;
}
.footer__links a:hover {
  color: #fff;
}
.footer__social {
  display: flex;
  gap: 14px;
  justify-self: end;
}
.footer__social a {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: #fff;
  text-decoration: none;
}
.footer__social a:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* ===== Responsive ===== */
@media (max-width: 960px) {
  .hero__inner {
    grid-template-columns: 1fr;
    text-align: left;
  }
  .hero__media {
    order: -1;
  }
  .hero__media img {
    max-width: 100%;
    margin-inline: auto;
  } /* más grande en móvil */
}

/* ==== MÓVIL: hamburguesa + drawer + footer centrado ==== */
@media (max-width: 640px) {
  /* Logo un poco más grande en móvil */
  .brand img {
    height: 150px;
    margin-top: -40px;
    margin-bottom: -55px;
  }

  /* Muestra la hamburguesa y colócala a la derecha (lugar del CTA) */
  .nav-toggle {
    display: inline-flex;
    order: 3;
    margin-left: auto;
    z-index: 70;
  }

  /* Drawer lateral derecho */
  .topbar .nav .menu {
    order: 2;
    position: fixed;
    top: 0;
    right: 0;
    z-index: 60;
    height: 100dvh;
    width: min(84vw, 340px);
    background: #fff;
    box-shadow: -2px 0 30px rgba(0, 0, 0, 0.12);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transform: translateX(100%);
    transition: transform 0.25s ease;
  }
  .topbar .nav .menu.open {
    transform: translateX(0);
  }
  .topbar .nav .menu a {
    display: block;
  }
  .topbar .nav .menu .btn {
    display: block;
    text-align: center;
  }

  /* Capa para cerrar tocando fuera */
  .nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 55;
    display: block;
  }
  .nav-overlay[hidden] {
    display: none;
  }

  /* Otros ajustes */
  .cta {
    flex-wrap: wrap;
  }
  .carousel__arrow {
    display: none;
  }

  /* Footer: centrar redes y layout de una columna */
  .footer__inner {
    grid-template-columns: 1fr;
    text-align: center;
    justify-items: center;
  }
  .footer__social {
    justify-self: center;
    justify-content: center;
  }
}

/* ===== Dropdown de Servicios (escritorio) ===== */
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-item .nav-link {
  font-weight: 700;
}
.nav-caret {
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: #1b2559;
  display: none; /* oculto por defecto, lo mostramos en desktop */
}
.nav-caret:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

@media (min-width: 641px) {
  .nav-caret {
    display: inline-grid;
    place-items: center;
  }

  .dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: min(560px, 90vw);
    background: #fff;
    border: 1px solid #eef0f5;
    border-radius: 14px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
    padding: 12px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    z-index: 70;
  }
  .dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    color: #1b2559;
    font-weight: 600;
  }
  .dropdown a:hover {
    background: #f6f7fb;
  }
  .dropdown img {
    width: 28px;
    height: 28px;
    object-fit: contain;
  }
  .dropdown__all {
    padding: 8px 4px 2px;
  }
}

/* ===== En móvil, los enlaces de servicios se muestran como lista normal dentro del drawer ===== */
@media (max-width: 640px) {
  .nav-services .dropdown {
    position: static;
    border: 0;
    box-shadow: none;
    padding: 4px 0 0;
    display: block !important;
  }
  .nav-services .dropdown a {
    padding: 8px 4px;
  }
  .nav-services .nav-caret {
    display: none;
  } /* no necesitamos caret en móvil */
}

/* 0) Asegura que el atributo [hidden] siempre oculte */
[hidden] {
  display: none !important;
}

/* 1) Dropdown de Servicios (ESCRITORIO) – respeta hidden + estilos */
@media (min-width: 641px) {
  /* respeta el hidden del HTML */
  .dropdown[hidden] {
    display: none !important;
  }

  .dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: min(560px, 90vw);
    background: #fff;
    border: 1px solid #eef0f5;
    border-radius: 14px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
    padding: 12px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    z-index: 70;
  }

  /* solo los <a> directos dentro del dropdown, no el botón final */
  .dropdown > a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    color: #1b2559;
    font-weight: 600;
  }
  .dropdown > a:hover {
    background: #f6f7fb;
  }

  .dropdown img {
    width: 22px;
    height: 22px;
    object-fit: contain;
  }

  /* botón "Ver todos los servicios" mantiene color */
  .dropdown__all .btn {
    background: var(--primary) !important;
    color: #fff !important;
    border-color: transparent !important;
    display: block;
    width: 100%;
    text-align: center;
  }
  .dropdown__all .btn:hover {
    filter: none;
    background: var(--primary);
  }
}

/* 2) Lista de servicios en el DRAWER (MÓVIL) – íconos y layout */
@media (max-width: 640px) {
  .nav-services .dropdown {
    position: static;
    border: 0;
    box-shadow: none;
    padding: 6px 0 0;
    display: block !important; /* visible dentro del drawer */
  }
  .nav-services .dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px;
    border-radius: 10px;
    color: #1b2559;
    text-decoration: none;
  }
  .nav-services .dropdown a:hover {
    background: #f6f7fb;
  }
  .nav-services .dropdown img {
    width: 26px;
    height: 26px;
    object-fit: contain;
  }
  .nav-services .nav-caret {
    display: none;
  } /* sin caret en móvil */
}

#mediacion-card h3,
#mediacion-card p {
  color: #ffffff !important;
}

/* Card Link in Carousel */
.card-link {
  display: block;
  text-decoration: none;
  height: 100%;
  color: inherit;
}
.card-link:hover .card {
  transform: translateY(-2px);
  transition: transform 0.2s ease;
}

/* ===== HEADER REDESIGN ===== */
.mobile-label,
.mobile-label-btn {
  display: none;
}
.desktop-only {
  display: inline-flex;
}

/* Mobile Drawer Styles */
@media (max-width: 640px) {
  /* Hide desktop elements */
  .desktop-only {
    display: none !important;
  }

  /* Drawer Layout */
  .topbar .nav .menu {
    padding: 24px;
    display: flex;
    flex-direction: column;
    height: 100dvh;
    background: #ffffff;
  }

  /* Menu Body (Services) */
  .menu-body {
    flex: 1;
    overflow-y: auto;
    margin-top: 40px; /* Push down below X button */
  }

  /* Section Label Button (Accordion Toggle) */
  .mobile-label-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: transparent;
    border: none;
    padding: 0 4px 16px;
    
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b; /* Slate 500 */
    cursor: pointer;
  }
  .mobile-label-btn i {
    font-size: 1rem;
    transition: transform 0.3s ease;
  }

  /* Services List Container (Accordion Content) */
  .nav-services {
    display: block;
    width: 100%;
  }
  .nav-services .dropdown {
    display: flex !important;
    flex-direction: column;
    gap: 16px; /* Increased gap */
    padding: 0 !important;
    
    /* Accordion Transition */
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease;
    max-height: 1000px; /* Arbitrary large height */
    opacity: 1;
    overflow: hidden;
  }
  
  /* Collapsed State */
  .nav-services .dropdown.collapsed {
    max-height: 0;
    opacity: 0;
    margin: 0;
    gap: 0;
  }

  /* Service Items (Cards) */
  .nav-services .dropdown a {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px; /* Larger padding */
    background: #f8fafc;
    border-radius: 16px;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.1s;
    border: 1px solid transparent;
  }
  .nav-services .dropdown a:active {
    background: #e2e8f0;
    transform: scale(0.98);
  }
  
  /* Icons in Menu */
  .nav-services .dropdown img {
    width: 36px; /* Slightly larger */
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
  }
  
  /* Text in Menu */
  .nav-services .dropdown span {
    font-size: 1rem; /* Larger text */
    font-weight: 600;
    color: #0f172a;
    line-height: 1.3;
  }

  /* Footer Section */
  .menu-footer {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  /* Secondary Links */
  .menu-link {
    font-size: 1rem;
    font-weight: 500;
    color: #334155;
    padding: 12px 4px;
    text-decoration: none;
  }
  
  /* CTA Button */
  .btn-block {
    display: block;
    width: 100%;
    text-align: center;
    padding: 16px;
    font-size: 1rem;
    margin-top: 8px;
  }
}
