:root {
  --bg: #ffffff;
  --text: #1a1a1a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --whatsapp: #25d366;
  --instagram: #c13584;
  --facebook: #1877F2;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  max-width: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
}

img, svg {
  display: block;
  max-width: 100%;
}

/* Container */
.container {
  width: 100%;
  max-width: 1100px;
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 24px);
}

/* Mobile: container uses 98% width */
@media (max-width: 600px) {
  .container {
    padding-inline: 1%;
  }
}

/* Accessibility */
.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: 16px;
  top: 16px;
  background: #fff;
  color: var(--text);
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Header */
.header {
  border-bottom: 1px solid var(--border);
  background: #fafafa;
}
.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  /* Keep vertical padding fixed and side padding responsive */
  padding-block: 14px;
  padding-inline: clamp(16px, 4vw, 24px);
}
.logo {
  font-weight: 700;
  font-size: 1.125rem;
}
.logo img { display: block; height: 35px; width: auto; }
.nav a {
  color: var(--text);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 6px;
}
.nav a:hover {
  background: #f3f4f6;
}

/* Hero */
.hero {
  padding: 72px 0;
}
.hero__inner {
  text-align: center;
}
.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.5rem, 2.5vw, 2rem);
}
.hero p {
  margin: 0 auto 16px;
  max-width: 60ch;
  color: var(--muted);
}
.hero__actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Hero with dynamic background */
#pymeHero {
  position: relative;
  display: grid;
  place-items: center;
  background-color: #f3f4f6;
  background-image: var(--hero-bg);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  min-height: 65vh;
  isolation: isolate;
}
#pymeHero .hero__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 1;
  pointer-events: none;
}
#pymeHero .hero__content {
  position: relative;
  color: #fff;
  text-align: center;
  padding-inline: 16px;
  z-index: 2;
}
#pymeHero h1 {
  margin: 0 0 8px;
  color: #fff;
  font-size: clamp(30px, 5.5vw, 56px);
  line-height: 1.05;
  font-weight: 700;
}
#pymeHero p {
  margin: 0 auto 16px;
  max-width: 60ch;
  color: #fff;
  font-size: clamp(18px, 2.4vw, 22px);
  opacity: 0.95;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  transition: background .2s ease, transform .04s ease;
}
.btn:focus {
  outline: 3px solid rgba(37, 99, 235, .35);
  outline-offset: 2px;
}
.btn:hover { background: #1d4ed8; }
.btn:active { transform: translateY(1px); }

.btn--whatsapp { background: var(--whatsapp); }
.btn--whatsapp:hover { background: #1ebe5a; }

.btn--instagram { background: var(--instagram); }
.btn--instagram:hover { background: #a52d71; }

.btn--facebook { background: var(--facebook); }
.btn--facebook:hover { background: #1665d8; }

/* Productos */
.productos {
  padding: 28px 0 40px;
}
.section__header {
  margin-bottom: 12px;
}
.section__header h2 {
  margin: 0;
  font-size: 1.25rem;
}
.productos__grid, #pymeProducts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  min-width: 0;
}
.product-card {
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}
.product-card__img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 0;
}
.product-card__placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 0;
  background:
    radial-gradient(1200px 200px at 50% 0%, rgba(0,0,0,.03), transparent),
    linear-gradient(180deg, #f9fafb, #f3f4f6);
}
.product-card__content {
  padding: 16px;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
.product-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}
.product-card p {
  margin: 0;
  color: var(--muted);
  flex: 1;
}
.product-card__price {
  display: block;
  margin-top: auto;
  padding-top: 8px;
  font-weight: 700;
  font-size: 1rem;
  color: #16a34a;
  text-align: right;
}

/* About (mini) */
.about-mini {
  padding: 52px 0;
  background: #f7f5f2;
  border-top: 1px solid #e6e8eb;
  border-bottom: 1px solid #e6e8eb;
}
.about-mini .container {
  text-align: center;
  max-width: 900px;
  padding-inline: 24px;
}
.about-mini .section__header { text-align: center; margin-bottom: 14px; }
.about-mini .section__header h2 {
  font-size: clamp(22px, 2.6vw, 26px);
  font-weight: 700;
}
.about-mini p {
  margin: 0;
  color: #555;
  font-size: clamp(15px, 2.4vw, 16px);
  line-height: 1.7;
  width: min(880px, 100%);
  margin-inline: auto;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 14px;
  padding: 24px 30px;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
}

/* Hide 'Quiénes somos' intro section across the system */
.about-mini { display: none !important; }

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  background: #fafafa;
}
.footer .container {
  padding: 16px 0;
  text-align: center;
  color: var(--muted);
}

/* Final block (About + Contact) */
.final-block {
  padding: 72px 0;
  background: #eef2f5;
  border-top: 1px solid #e6e8eb;
}
.final-block .container { max-width: 1100px; padding-inline: 24px; }
.final-block__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  align-items: start;
}
.final-block__left .section__header h2 { font-weight: 700; }
.final-block__left p {
  margin: 0;
  color: #555;
  line-height: 1.75;
  max-width: 65ch;
}
.final-block__right .section__header { text-align: center; }
.final-block__intro {
  margin-top: 8px;
  margin-bottom: 18px;
  color: #666;
  text-align: center;
}
.contact__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  justify-content: center;
}
/* Grid layout for contact buttons inside final block */
.final-block .contact__actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-width: 340px;
  margin-inline: auto;
}
.final-block .contact__actions a {
  width: 100%;
  max-width: none;
  min-width: 0;
}
/* Center the third (odd) button when there are 3 */
.final-block .contact__actions a:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  justify-self: center;
  width: calc(50% - 6px);
}
.final-block .contact__actions.contact__actions--single {
  display: flex;
  justify-content: center;
}
.final-block .contact__actions.contact__actions--single a {
  width: auto;
  min-width: 160px;
  max-width: 240px;
}
.contact__actions a {
  flex: 0 0 auto;
  min-width: 160px;
  max-width: 240px;
}
/* Contact buttons tuning scoped to final block */
#pymeContactActions .btn {
  height: 46px;
  padding: 0 20px;
  border-radius: 12px;
}
#pymeContactActions .btn:hover {
  filter: brightness(0.97);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
#pymeContactActions .btn:focus {
  outline: 3px solid rgba(37, 99, 235, .35);
  outline-offset: 2px;
}

/* Servicios */
.servicios { padding: 60px 0 40px; }
#pymeServices {
  display: flex;
  flex-direction: column;
  gap: 32px;
  min-width: 0;
}

/* Grid legacy necesita margen inferior en móvil */
@media (max-width: 600px) {
  .legacy-grid {
    margin-bottom: 40px;
  }
  .seccion__grid {
    margin-bottom: 40px;
  }
  
  /* Servicios padding extra en móvil */
  .servicios {
    padding-bottom: 40px;
  }
  
  /* Final block necesita estar por encima */
  .final-block {
    position: relative;
    z-index: 5;
  }
}

/* Secciones personalizables */
.seccion {
  width: 100%;
}

.seccion__header {
  margin-bottom: 16px;
  text-align: center;
}

.seccion__header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
}

/* Título destacado - más grande */
.seccion__header--destacada h3 {
  font-size: 1.75rem;
  font-weight: 700;
}

@media (min-width: 768px) {
  .seccion__header--destacada h3 {
    font-size: 2rem;
  }
}

.seccion__contenido {
  width: 100%;
}

.seccion__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

/* Grid legacy para compatibilidad con páginas antiguas */
.legacy-grid {
  width: 100%;
}

@media (min-width: 1024px) {
  .seccion__grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
.service-card {
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}
.service-card__img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 0;
  overflow: hidden;
}
.service-card__content { 
  padding: 16px; 
  display: flex;
  flex-direction: column;
}
.service-card__content h3 {
  margin: 0 0 4px;
}
.service-card__content p {
  margin: 0 0 8px;
  flex: 1;
}
.service-card__price {
  display: block;
  text-align: right;
  margin-top: auto;
  color: #16a34a;
  font-weight: 700;
  font-size: 1rem;
}

/* Tarjetas verticales (imágenes portrait) */
.service-card--vertical .service-card__img {
  aspect-ratio: 3 / 4;
}
.service-card--vertical.service-card--featured .service-card__img {
  aspect-ratio: 3 / 4;
  height: auto;
}

/* Tarjetas de solo imagen (sin texto) */
.service-card--image-only {
  grid-template-rows: 1fr;
}
.service-card--image-only .service-card__img {
  border-radius: 4px;
}

/* Breakpoints */
@media (max-width: 768px) {
  .contact__actions {
    justify-content: center;
    width: 100%;
  }
  .contact__actions a {
    width: min(100%, 340px);
    max-width: 340px;
  }
  .about-mini { padding: 48px 0; }
  .final-block { padding: 56px 0; }
}

@media (max-width: 420px) {
  .contact__actions a { width: 100%; max-width: none; }
}

/* Force two columns on mobile for products and services */
@media (max-width: 600px) {
  /* Logo same size as main page */
  .logo img { height: 35px; }

  /* Cards: full width within container, 2% gap center */
  .productos__grid, #pymeProducts, .seccion__grid, .legacy-grid {
    grid-template-columns: repeat(2, 1fr);
    width: 100%;
    gap: 2%;
  }

  /* Border-radius 4px and separator lines like Mercado Libre */
  .product-card, .service-card {
    border-radius: 4px;
    border-bottom: 1px solid var(--border);
    position: relative;
  }

  /* Vertical separator between columns */
  .product-card:nth-child(odd)::after,
  .service-card:nth-child(odd)::after {
    content: '';
    position: absolute;
    right: -1%;
    top: 5%;
    height: 90%;
    width: 1px;
    background: var(--border);
  }

  /* Fixed height image section */
  .product-card__img, .service-card__img {
    height: 130px;
    aspect-ratio: unset;
    border-radius: 0;
    overflow: hidden;
  }

  /* Fixed height content section */
  .product-card__content, .service-card__content {
    height: auto;
    min-height: 90px;
    padding: 8px 8px 10px;
  }
  
  /* Precio más pequeño en móvil */
  .service-card__price {
    font-size: 0.85rem;
    margin-top: 4px;
  }

  /* Servicio destacado ocupa fila completa en móvil */
  .service-card--featured {
    grid-column: 1 / -1;
    overflow: visible;
  }
  .service-card--featured .service-card__img {
    height: 180px;
  }
  .service-card--featured .service-card__content {
    height: auto;
    min-height: auto;
    overflow: visible;
  }
  .service-card--featured .service-card__price {
    display: block;
    font-size: 0.9rem;
    margin-top: 8px;
  }
  /* Quitar separador vertical en destacados */
  .service-card--featured::after {
    display: none;
  }

  /* Tarjetas verticales en móvil */
  .service-card--vertical {
    grid-template-rows: 300px auto;
    overflow: visible;
  }
  .service-card--vertical .service-card__img {
    height: 300px;
    aspect-ratio: unset;
    object-fit: cover;
  }
  .service-card--vertical .service-card__content {
    padding: 6px 8px 8px;
    display: flex;
    flex-direction: column;
    background: #fff;
    min-height: auto;
  }
  .service-card--vertical .service-card__content h3 {
    font-size: 0.7rem;
    margin-bottom: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  /* Ocultar descripción vacía */
  .service-card--vertical .service-card__content p:empty {
    display: none;
  }
  .service-card--vertical .service-card__price {
    margin-top: 4px;
    font-size: 0.75rem;
  }
  
  /* Tarjetas verticales destacadas en móvil */
  .service-card--vertical.service-card--featured {
    grid-template-rows: 420px auto;
    overflow: visible;
  }
  .service-card--vertical.service-card--featured .service-card__img {
    height: 420px;
    aspect-ratio: unset;
  }
  .service-card--vertical.service-card--featured .service-card__content {
    min-height: auto;
    padding: 12px;
  }
  .service-card--vertical.service-card--featured .service-card__content h3 {
    font-size: 1rem;
  }
}

@media (min-width: 600px) {
  .productos__grid, #pymeProducts { grid-template-columns: repeat(2, 1fr); }
  #pymeServices { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  #pymeHero { min-height: 75vh; }
  .productos__grid, #pymeProducts { grid-template-columns: repeat(4, 1fr); }
  #pymeServices { grid-template-columns: repeat(4, 1fr); }
  .service-card--featured { grid-column: span 2; }
  .logo img { height: 39px; }
}

@media (min-width: 900px) {
  .final-block__grid { grid-template-columns: 1.5fr 1fr; gap: 48px; }
  .final-block .contact__actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .final-block .contact__actions a:nth-child(3) { grid-column: 1 / -1; }
}

@media (max-width: 420px) {
  .final-block .contact__actions.contact__actions--single a { width: auto; max-width: 100%; }
}

/* Mobile layout tuning for images and content balance */
@media (max-width: 600px) {
  /* Reduce padding */
  .product-card__content, .service-card__content { padding: 8px; }
  
  /* Title - permitir 2 líneas */
  .product-card h3, .service-card h3 {
    font-size: 0.85rem;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  
  /* Description - permitir 3 líneas */
  .product-card p, .service-card p {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.75rem;
    line-height: 1.35;
  }
  
  /* Tarjetas verticales: más espacio para texto */
  .service-card--vertical .service-card__content h3 {
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }
  .service-card--vertical .service-card__content p {
    -webkit-line-clamp: 4;
    line-clamp: 4;
  }
  
  /* Precio visible en móvil */
  .service-card__price {
    font-size: 0.8rem;
    margin-top: 4px;
  }
}

/* =========================
   CARRUSEL DE PRODUCTOS
   ========================= */

.carousel-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 0;
}

.carousel {
  position: relative;
  width: 80%;
  max-width: 900px;
  margin: 0 auto;
  overflow: hidden;
}

.carousel__track {
  display: flex;
  transition: transform 0.4s ease-in-out;
}

.carousel__slide {
  flex: 0 0 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.carousel__slide img {
  max-width: 100%;
  max-height: 75vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.carousel__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.carousel__btn:hover {
  background: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  transform: translateY(-50%) scale(1.05);
}

.carousel__btn:focus {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}

.carousel__btn--prev {
  left: 16px;
}

.carousel__btn--next {
  right: 16px;
}

.carousel__btn svg {
  width: 24px;
  height: 24px;
  stroke: var(--text);
  stroke-width: 2.5;
  fill: none;
}

.carousel__dots {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
}

.carousel__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s, transform 0.2s;
}

.carousel__dot--active {
  background: var(--primary);
  transform: scale(1.2);
}

.carousel__dot:hover {
  background: var(--muted);
}

.carousel__dot--active:hover {
  background: var(--primary);
}

/* Carrusel responsive */
@media (max-width: 600px) {
  .carousel-container {
    padding: 10px 0;
  }
  
  .carousel {
    width: 100%;
    max-width: 100%;
  }
  
  /* Ocultar botones de navegación en móvil */
  .carousel__btn {
    display: none;
  }
  
  .carousel__slide {
    padding: 10px;
  }
  
  .carousel__slide img {
    max-height: 65vh;
    border-radius: 8px;
  }
  
  .carousel__dots {
    margin-top: 16px;
  }
}
