/* =========================================================
   Amigo Digital - Estilos principales (HTML + CSS + JS puro)
   Paleta:
   - Primario: #E6621F
   - Complementario 1: #EDEDEE
   - Complementario 2: #898989
   - Oscuro: #333333
   - Claro: #FFFFFF
   ========================================================= */

:root {
  --primary: #E6621F;
  --gray-1: #EDEDEE;
  --gray-2: #898989;
  --dark:   #333333;
  --light:  #FFFFFF;
  --radius: 16px;
  --header-h: 64px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--dark);
  background: #fff;
  line-height: 1.6;
}
body.nav-open { overflow: hidden; }

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.center { text-align: center; }
.mt-3 { margin-top: 24px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--gray-1);
  transition: box-shadow .2s ease, background .2s ease, border-color .2s ease;
}
.site-header.scrolled,
body.nav-open .site-header {
  /* Sombra al hacer scroll o con menú abierto */
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
  border-color: rgba(0,0,0,0);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-logo { width: 40px; height: 40px; border-radius: 999px; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.brand-name { font-weight: 600; font-size: 18px; }

/* Navegación */
.main-nav { display: flex; align-items: center; gap: 16px; }
.nav-link { opacity: .9; transition: color .2s ease, opacity .2s ease; }
.nav-link:hover { color: var(--primary); opacity: 1; }
.nav-link.is-active { color: var(--primary); font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 16px; border-radius: 12px; font-weight: 600; cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease, color .2s ease, border-color .2s ease;
}
.btn-primary {
  background: var(--primary); color: #fff;
  box-shadow: 0 6px 16px rgba(230, 98, 31, 0.25);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 20px rgba(230, 98, 31, 0.35); }
.btn-ghost {
  border: 1px solid var(--gray-1); color: var(--dark); background: #fff;
}
.btn-ghost:hover { border-color: var(--gray-2); }

/* Helpers responsive */
.show-mobile { display: none; }
.hide-mobile { display: inline-flex; }
@media (max-width: 960px) {
  .show-mobile { display: block !important; }
  .hide-mobile { display: none !important; }
}

/* Botón hamburguesa (visible solo en mobile) */
.menu-toggle {
  display: none;
  height: 40px; width: 40px;
  border: none; background: transparent; cursor: pointer;
  align-items: center; justify-content: center;
  margin-left: 8px;
}
.menu-toggle .bar {
  display: block; width: 22px; height: 2px; background: var(--dark);
  border-radius: 2px; position: relative; transition: transform .2s ease, opacity .2s ease, background .2s ease;
}
.menu-toggle .bar + .bar { margin-top: 5px; }
/* Animación a "X" cuando está abierto */
.menu-toggle.is-open .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.is-open .bar:nth-child(2) { opacity: 0; }
.menu-toggle.is-open .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Menú móvil desplegable */
@media (max-width: 960px) {
  .menu-toggle { display: inline-flex; }
  .main-nav {
    position: fixed; left: 0; right: 0; top: var(--header-h);
    background: #fff; border-bottom: 1px solid var(--gray-1);
    display: block; padding: 12px 16px;
    transform: translateY(-16px); opacity: 0; pointer-events: none;
    transition: opacity .22s ease, transform .22s ease;
    will-change: transform, opacity;
    z-index: 55; /* encima del backdrop, debajo del header */
  }
  .main-nav.is-open {
    transform: translateY(0); opacity: 1; pointer-events: auto;
    animation: menu-slide-down .22s ease;
  }
  .main-nav .nav-link, .main-nav .btn {
    display: block; padding: 10px 0;
  }
  /* Animación suave de los ítems al abrir */
  .main-nav.is-open .nav-link,
  .main-nav.is-open .btn,
  .main-nav.is-open .contact-dropdown {
    animation: item-fade .25s ease both;
  }
  .main-nav.is-open .nav-link:nth-child(1) { animation-delay: .02s; }
  .main-nav.is-open .nav-link:nth-child(2) { animation-delay: .04s; }
  .main-nav.is-open .nav-link:nth-child(3) { animation-delay: .06s; }
  .main-nav.is-open .contact-dropdown { animation-delay: .08s; }
}

/* Backdrop cuando menú móvil está abierto */
.menu-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.35);
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
  z-index: 50; /* por debajo del header (60) y el nav (55) */
}
body.nav-open .menu-backdrop { opacity: 1; pointer-events: auto; }

/* Contacto (dropdown mobile) */
.contact-dropdown { margin-top: 4px; }
.contact-trigger { width: 100%; }
.contact-menu {
  margin-top: 8px; border: 1px solid var(--gray-1); border-radius: 12px; background: #fff; overflow: hidden;
}
.contact-item { display: block; padding: 10px 12px; }
.contact-item:hover { background: var(--gray-1); }

/* Secciones */
.section { padding: 64px 0; }
.section.gray { background: var(--gray-1); }
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 24px;
}
.h1 { font-size: 36px; margin: 0 0 8px; font-weight: 800; }
.h2 { font-size: 32px; margin: 0 0 8px; font-weight: 800; }
.h3 { font-size: 20px; margin: 0 0 8px; font-weight: 700; }
.lead { color: rgba(51,51,51,.85); }

/* Grids */
.grid { display: grid; gap: 24px; }
.grid.two { grid-template-columns: 1.2fr 1fr; align-items: center; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 960px) {
  .grid.two { grid-template-columns: 1fr; }
  .grid.three { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid.three { grid-template-columns: 1fr; }
}

/* Media y contenido */
.media .rounded { border-radius: 12px; }
.shadow { box-shadow: 0 12px 24px rgba(0,0,0,.08); }
.content p { margin: 0 0 10px; color: rgba(51,51,51,.88); }
.cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.link-primary { color: var(--primary); }
.link-primary:hover { text-decoration: underline; }

/* Cards */
.card {
  background: #fff; border: 1px solid var(--gray-1); border-radius: var(--radius); overflow: hidden;
  transition: box-shadow .25s ease, transform .2s ease, border-color .2s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(0,0,0,.08); border-color: #e9e9ea; }
.card-media { overflow: hidden; }
.card-media img { width: 100%; height: 200px; object-fit: cover; transition: transform .5s ease; display: block; }
.card:hover .card-media img { transform: scale(1.05); }
.card-body { padding: 16px; }
.muted { color: var(--gray-2); font-size: 14px; }

/* Slider */
.slider { position: relative; height: 60vh; min-height: 420px; background: #000; overflow: hidden; }
@media (min-width: 960px) { .slider { height: 70vh; } }
.slides { position: relative; width: 100%; height: 100%; }
.slide {
  position: absolute; inset: 0;
  opacity: 0; transition: opacity .7s ease;
}
.slide.is-active { opacity: 1; z-index: 1; }
.slide-bg { width: 100%; height: 100%; object-fit: cover; }
.overlay { position: absolute; inset: 0; background: rgba(0,0,0,.4); }
.slide-content {
  position: absolute; inset: 0; display: flex; align-items: center;
}
.slide-content .slide-title { color: #fff; font-size: 36px; font-weight: 800; margin: 0 0 6px; text-shadow: 0 2px 6px rgba(0,0,0,.3); }
.slide-subtitle { color: rgba(255,255,255,.92); margin: 0 0 16px; max-width: 600px; }

/* Botones del slider */
.slider-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  height: 40px; width: 40px; border-radius: 999px; background: rgba(255,255,255,0.9);
  border: none; cursor: pointer; font-size: 18px; line-height: 1;
  box-shadow: 0 8px 20px rgba(0,0,0,.15);
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
  z-index: 10;
}
.slider-btn:hover { transform: translateY(-50%) scale(1.05); background: #fff; }
.slider-btn.prev { left: 12px; }
.slider-btn.next { right: 12px; }
@media (max-width: 640px) { .slider-btn { display: none; } }

/* Indicadores del slider */
.dots {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px; z-index: 10;
}
.dots button {
  width: 10px; height: 10px; border-radius: 999px; border: none; cursor: pointer;
  background: rgba(255,255,255,.6); transition: width .2s ease, background .2s ease;
}
.dots button.is-active { width: 16px; background: #fff; }

/* Revelar en scroll */
.reveal { opacity: 0; }
.reveal.reveal-right { transform: translateX(32px); }
.reveal.reveal-left { transform: translateX(-32px); }
.reveal.in-view { opacity: 1; transform: translateX(0); transition: transform .6s ease, opacity .6s ease; }

/* Footer */
.site-footer { background: var(--dark); color: #fff; padding-top: 48px; }
.footer-grid {
  display: grid; gap: 24px; grid-template-columns: repeat(4, 1fr);
}
.footer-logo { width: 48px; height: 48px; border-radius: 999px; }
.footer-title { font-weight: 700; margin: 0 0 8px; }
.footer-list { list-style: none; padding: 0; margin: 0; }
.footer-list li a { color: rgba(255,255,255,.8); }
.footer-list li a:hover { color: #fff; }
.footer-copy {
  border-top: 1px solid rgba(255,255,255,.12); margin-top: 24px; padding: 16px 0;
  color: rgba(255,255,255,.7); font-size: 12px;
}
@media (max-width: 960px) { .footer-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .footer-grid { grid-template-columns: 1fr; } }

/* Botón flotante de WhatsApp */
.wa-float {
  position: fixed; right: 20px; bottom: 20px; z-index: 40;
  width: 56px; height: 56px; border-radius: 999px; background: #25D366; display: flex;
  align-items: center; justify-content: center; box-shadow: 0 10px 24px rgba(0,0,0,.25);
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 1px, 1px); white-space: nowrap; border: 0; }

/* Loader de portafolio */
.loader {
  position: fixed; inset: 0; background: #fff; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 24px; z-index: 70;
}
.loader.hidden { display: none; }
.loader-logo { width: 80px; height: 80px; border-radius: 999px; margin-bottom: 16px; box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.loader-text { margin: 0 0 8px; color: var(--dark); font-weight: 600; }
.loader-bar { width: 100%; max-width: 480px; height: 12px; background: var(--gray-1); border-radius: 999px; overflow: hidden; }
.loader-bar span { display: block; height: 100%; background: var(--primary); transition: width .2s ease; }

@keyframes menu-slide-down {
  from { transform: translateY(-16px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}
@keyframes item-fade {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
