/* ============================================================
   NATEXA — rubro-extras.css
   Estilos compartidos para las páginas de rubro:
   - Sección "Showcase" (texto comercial + collage animado)
   - Carrusel de imágenes
   - Lightbox con zoom y paneo
   ============================================================ */

/* ============ SHOWCASE ============ */
.rubro-showcase {
  padding: 60px 0;
  background: var(--blanco);
  overflow: hidden;
  position: relative;
}
.rubro-showcase::before {
  content: '';
  position: absolute;
  top: -120px; right: -120px;
  width: 360px; height: 360px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(68,170,236,.08), transparent 70%);
  pointer-events: none;
}
.rubro-showcase-grid {
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  gap: 60px;
  align-items: center;
  position: relative;
  z-index: 1;
}
.rubro-text .section-eyebrow {
  display: inline-block;
  font-family: var(--font-titulo);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--azul-700);
  background: linear-gradient(135deg, rgba(68,170,236,.1), rgba(44,76,199,.08));
  padding: 7px 14px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.rubro-text h2 {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 800;
  margin-bottom: 22px;
  line-height: 1.15;
}
.rubro-text h2 .accent { color: var(--azul-500); }
.rubro-lead {
  color: var(--texto-suave);
  font-size: 16px;
  line-height: 1.7;
  margin-bottom: 24px;
}
.rubro-products-list {
  list-style: none;
  margin-bottom: 24px;
  padding: 0;
}
.rubro-products-list li {
  padding: 13px 0 13px 28px;
  position: relative;
  border-bottom: 1px solid var(--gris-borde);
  font-size: 15px;
  color: var(--texto);
  line-height: 1.5;
  transition: padding-left .2s ease;
}
.rubro-products-list li:last-child { border-bottom: none; }
.rubro-products-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 22px;
  width: 16px;
  height: 2px;
  background: var(--azul-500);
  border-radius: 2px;
  transition: width .25s ease, background .25s ease;
}
.rubro-products-list li:hover::before {
  width: 22px;
  background: var(--azul-700);
}
.rubro-products-list li:hover { padding-left: 34px; }
.rubro-products-list strong {
  color: var(--azul-900);
  font-weight: 700;
  font-family: var(--font-titulo);
  margin-right: 6px;
}
.rubro-foot {
  color: var(--texto-suave);
  font-size: 14px;
  font-style: italic;
  margin-bottom: 28px;
  line-height: 1.6;
}

/* ============ COLLAGE ============ */
.rubro-collage {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-content: center;
  position: relative;
  contain: layout paint;
}
.rubro-collage .cg {
  position: relative;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  box-shadow: 0 30px 60px -20px rgba(30,61,143,.4);
  object-fit: cover;
  object-position: center top;
  opacity: 0;
  transform: translateY(28px) scale(.96);
  transition: transform 1.2s cubic-bezier(.22,.85,.25,1), opacity 1s ease;
  border: 4px solid white;
  background: var(--gris-bg);
}
.rubro-collage.in-view .cg { opacity: 1; }

/* Posiciones finales del collage (5 imágenes) */
.cg-1, .cg-2, .cg-3, .cg-4, .cg-5 { z-index: 1; }

.rubro-collage.in-view .cg-1 { transform: translateY(0) scale(1); transition-delay: .10s; }
.rubro-collage.in-view .cg-2 { transform: translateY(0) scale(1); transition-delay: .20s; }
.rubro-collage.in-view .cg-3 { transform: translateY(0) scale(1); transition-delay: .30s; }
.rubro-collage.in-view .cg-4 { transform: translateY(0) scale(1); transition-delay: .40s; }
.rubro-collage.in-view .cg-5 { transform: translateY(0) scale(1); transition-delay: .50s; }

.rubro-collage .cg:hover {
  z-index: 2;
  transform: translateY(-6px) scale(1.02) !important;
  box-shadow: 0 40px 80px -16px rgba(30,61,143,.55);
}

/* Placeholder si la imagen no carga */
.rubro-collage .cg-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--gris-bg), var(--gris-borde));
  color: var(--texto-suave);
  font-size: 12px;
  text-align: center;
}

/* ============ CARRUSEL ============ */
.rubro-carousel-section {
  padding: 56px 0 72px;
  background: var(--gris-bg);
  position: relative;
}
.rubro-carousel-head {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 32px;
}
.rubro-carousel-head .section-eyebrow {
  display: inline-block;
  font-family: var(--font-titulo);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--azul-700);
  background: white;
  padding: 7px 14px;
  border-radius: 999px;
  margin-bottom: 14px;
  border: 1px solid var(--gris-borde);
}
.rubro-carousel-head h2 {
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 800;
  margin: 4px 0 12px;
}
.rubro-carousel-head h2 .accent { color: var(--azul-500); }
.rubro-carousel-head p { color: var(--texto-suave); }

.carousel {
  position: relative;
  display: block;
}
.carousel-track-wrap {
  overflow: visible;
  position: relative;
  padding: 0;
}
.carousel-track {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 18px;
  transform: none !important;
}
.carousel-slide {
  flex: initial !important;
  width: auto !important;
  border-radius: 18px;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  box-shadow: 0 18px 40px -16px rgba(30,61,143,.25);
  cursor: zoom-in;
  position: relative;
  background: var(--gris-bg);
  transition: transform .35s ease, box-shadow .35s ease;
}
.carousel-slide:hover {
  box-shadow: 0 26px 50px -18px rgba(30,61,143,.4);
}
.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top; /* priorizar cabeza/torso del sujeto */
  transition: transform .5s ease;
  display: block;
}
.carousel-slide:hover img { transform: scale(1.06); }
.carousel-slide::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(10,20,50,.35));
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
}
.carousel-slide:hover::after { opacity: 1; }
.carousel-slide-zoom {
  position: absolute;
  bottom: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,.95);
  color: var(--azul-900);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .25s ease, transform .25s ease;
  pointer-events: none;
}
.carousel-slide:hover .carousel-slide-zoom {
  opacity: 1;
  transform: translateY(0);
}

.carousel-arrow {
  display: none;
  flex-shrink: 0;
  background: white;
  border: 1.5px solid var(--gris-borde);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--azul-900);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all .25s ease;
  z-index: 5;
}
.carousel-arrow:hover {
  background: var(--azul-900);
  color: white;
  border-color: var(--azul-900);
  transform: scale(1.08);
}
.carousel-arrow:active { transform: scale(.95); }

.carousel-dots {
  display: none;
  justify-content: center;
  gap: 8px;
  margin-top: 28px;
  flex-wrap: wrap;
}
.carousel-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gris-borde);
  border: none;
  cursor: pointer;
  transition: all .25s ease;
  padding: 0;
}
.carousel-dot.active {
  background: var(--azul-700);
  transform: scale(1.4);
}
.carousel-dot:hover { background: var(--azul-500); }

/* ============ LIGHTBOX ============ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(8,15,35,.95);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
}
.lightbox.open {
  opacity: 1;
  visibility: visible;
}
.lightbox-stage {
  width: 90%;
  height: 86%;
  overflow: hidden;
  cursor: zoom-in;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  position: relative;
}
.lightbox-stage.is-zoomed { cursor: grab; }
.lightbox-stage.is-grabbing { cursor: grabbing; }
.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  transition: transform .2s ease;
  transform-origin: center center;
  user-select: none;
  pointer-events: none;
  display: block;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
  border-radius: 8px;
}
.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.22);
  color: white;
  cursor: pointer;
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .25s ease;
}
.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255,255,255,.22);
  transform: scale(1.08);
}
.lightbox-close {
  top: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  z-index: 5;
}
.lightbox-prev,
.lightbox-next {
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  z-index: 5;
}
.lightbox-prev { left: 24px; }
.lightbox-next { right: 24px; }
.lightbox-prev:hover { transform: translateY(-50%) scale(1.08); }
.lightbox-next:hover { transform: translateY(-50%) scale(1.08); }

.lightbox-controls {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,.1);
  border-radius: 999px;
  padding: 6px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.2);
  z-index: 5;
}
.lb-ctrl {
  background: transparent;
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-titulo);
}
.lb-ctrl:hover { background: rgba(255,255,255,.22); }
.lb-counter {
  display: flex;
  align-items: center;
  padding: 0 14px;
  color: rgba(255,255,255,.85);
  font-family: var(--font-titulo);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .5px;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 960px) {
  .rubro-showcase-grid {
    grid-template-columns: 1fr;
    gap: 50px;
  }
  .rubro-collage {
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
  }
  /* .carousel-slide: el ancho lo maneja JS según breakpoint */
}
@media (max-width: 600px) {
  .rubro-showcase {
  padding: 60px 0; }
  .rubro-carousel-section {
  padding: 56px 0 72px; }
  .carousel-track { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .carousel-arrow {
    width: 44px;
    height: 44px;
  }
  .lightbox-prev,
  .lightbox-next {
    width: 44px;
    height: 44px;
  }
  .lightbox-close {
    width: 42px;
    height: 42px;
    top: 16px;
    right: 16px;
  }
  .lightbox-prev { left: 12px; }
  .lightbox-next { right: 12px; }
  .rubro-collage { gap: 14px; }
  .rubro-text h2 { font-size: 28px; }
}

/* ============ PRODUCTO DESTACADO EN LA LISTA ============ */
.rubro-products-list li.highlight {
  background: linear-gradient(135deg, rgba(68,170,236,.10), rgba(44,76,199,.05));
  border-radius: 12px;
  padding: 13px 14px 13px 28px;
  border-bottom: none;
  margin: 6px 0;
  position: relative;
}
.rubro-products-list li.highlight::before {
  left: 14px;
  background: var(--azul-700);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  top: 50%;
  transform: translateY(-50%);
}
.rubro-products-list li.highlight strong { color: var(--azul-700); }

/* ============ CURSOR ZOOM EN EL LIGHTBOX ============ */
.lightbox-stage { cursor: zoom-in; }
.lightbox-stage.is-zoomed { cursor: zoom-out; }
.lightbox-stage.is-grabbing { cursor: grabbing !important; }

/* ============ DESTACADOS MAIN (INDEX) ============ */
.destacados-main {
  padding: 80px 0 90px;
  background: linear-gradient(180deg, white 0%, var(--gris-bg) 100%);
  position: relative;
  overflow: hidden;
}
.destacados-main::before,
.destacados-main::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(68,170,236,.08), transparent 70%);
  pointer-events: none;
}
.destacados-main::before { top: -200px; right: -200px; width: 500px; height: 500px; }
.destacados-main::after  { bottom: -200px; left: -200px; width: 450px; height: 450px;
  background: radial-gradient(circle, rgba(44,76,199,.07), transparent 70%); }

.destacados-head {
  text-align: center;
  margin-bottom: 32px;
  position: relative;
  z-index: 1;
}
.destacados-head .section-eyebrow {
  display: inline-block;
  font-family: var(--font-titulo);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--azul-700);
  background: rgba(68,170,236,.10);
  padding: 7px 14px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.destacados-head h2 {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 800;
  margin: 6px 0 12px;
  color: var(--azul-900);
}
.destacados-head h2 .accent { color: var(--azul-500); }
.destacados-head p {
  color: var(--texto-suave);
  max-width: 620px;
  margin: 0 auto;
}

.destacados-stage {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 680px;
  z-index: 1;
  /* prevenir CLS reservando espacio */
  contain: layout paint;
}
.destacados-card {
  position: absolute;
  width: 480px;           /* ← tamaño nativo de las fotos (no upscaling) */
  max-width: 90vw;
  aspect-ratio: 3 / 4;
  border-radius: 22px;
  overflow: hidden;        /* recorta la imagen al border-radius sin necesidad de mask */
  transition: transform .8s cubic-bezier(.22,.85,.25,1), opacity .8s ease, filter .8s ease;
  cursor: zoom-in;
  box-shadow: 0 18px 50px -18px rgba(15,31,74,.35);
}
.destacados-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  border-radius: 22px;
  display: block;
  /* Máxima nitidez: render natural + sin transform que desplace subpíxeles */
  image-rendering: auto;
  -webkit-backface-visibility: hidden;
          backface-visibility: hidden;
  transform: translateZ(0); /* fuerza capa GPU dedicada → menos blur por filtros vecinos */
}
.destacados-card.is-active {
  z-index: 5;
  transform: translateX(0) scale(1) rotate(0deg);
  opacity: 1;
  filter: brightness(1);
}
.destacados-card.is-prev {
  z-index: 3;
  transform: translateX(-62%) scale(.78) rotate(-4deg);
  opacity: .55;
  filter: brightness(.85);
}
.destacados-card.is-next {
  z-index: 3;
  transform: translateX(62%) scale(.78) rotate(4deg);
  opacity: .55;
  filter: brightness(.85);
}
.destacados-card.is-prev2 {
  z-index: 2;
  transform: translateX(-105%) scale(.62) rotate(-8deg);
  opacity: .25;
  filter: brightness(.7);
}
.destacados-card.is-next2 {
  z-index: 2;
  transform: translateX(105%) scale(.62) rotate(8deg);
  opacity: .25;
  filter: brightness(.7);
}
.destacados-card.is-hidden {
  z-index: 1;
  transform: translateX(0) scale(.5);
  opacity: 0;
  pointer-events: none;
}

.destacados-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: white;
  border: 1.5px solid var(--gris-borde);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--azul-900);
  cursor: pointer;
  box-shadow: 0 10px 30px -10px rgba(30,61,143,.3);
  transition: all .25s ease;
  z-index: 20;
}
.destacados-arrow:hover {
  background: var(--azul-900);
  color: white;
  border-color: var(--azul-900);
  transform: translateY(-50%) scale(1.1);
}
.destacados-prev { left: 4%; }
.destacados-next { right: 4%; }

.destacados-dots {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 32px;
}
.destacados-dot {
  width: 28px;
  height: 4px;
  border-radius: 999px;
  background: var(--gris-borde);
  border: none;
  cursor: pointer;
  transition: all .25s ease;
  padding: 0;
}
.destacados-dot.is-active {
  background: var(--azul-700);
  width: 44px;
}

@media (max-width: 720px) {
  .destacados-stage { height: 560px; }
  .destacados-card { width: min(420px, 86vw); }
  .destacados-arrow { width: 44px; height: 44px; }
  .destacados-prev { left: 2%; }
  .destacados-next { right: 2%; }
}
@media (max-width: 480px) {
  .destacados-stage { height: 470px; }
  .destacados-card { width: min(340px, 88vw); }
  .destacados-card.is-prev,
  .destacados-card.is-next { opacity: .25; transform: translateX(-58%) scale(.72) rotate(-3deg); }
  .destacados-card.is-next { transform: translateX(58%) scale(.72) rotate(3deg); }
  .destacados-card.is-prev2,
  .destacados-card.is-next2 { display: none; }
}

/* Estabilidad extra: evitar drag fantasma de imágenes y selección de texto durante swipe */
.carousel-slide img {
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none; /* el click bubblea al .carousel-slide */
}
.carousel-track-wrap {
  touch-action: pan-y; /* permite scroll vertical, captura horizontal */
}
.carousel-arrow:disabled {
  opacity: .35;
  cursor: not-allowed;
}
.carousel-arrow:disabled:hover {
  background: white;
  color: var(--azul-900);
  border-color: var(--gris-borde);
  transform: none;
}

/* ============ RESPONSIVE FINE-TUNING ============ */
/* Touch targets mínimos (a11y) */
.btn, .carousel-arrow, .lightbox-prev, .lightbox-next, .lightbox-close,
.lb-ctrl, .destacados-arrow, .form-modal-close, .search-nav-btn {
  min-width: 40px;
  min-height: 40px;
}

/* Imágenes responsivas — sin desbordes */
img { max-width: 100%; height: auto; }
.destacados-card img,
.carousel-slide img,
.lightbox-img { height: 100%; }

/* Evitar overflow horizontal global */
html, body { overflow-x: hidden; }
.wrap { width: 100%; box-sizing: border-box; }

/* Tabletas (768px) — ajustes ya cubiertos por media queries existentes */

/* Móvil grande (480–640px) */
@media (max-width: 640px) {
  .rubro-showcase { padding: 56px 0 64px; }
  .rubro-carousel-section { padding: 50px 0 64px; }
  .rubro-text h2 { font-size: clamp(24px, 6vw, 32px); }
  .rubro-carousel-head h2 { font-size: clamp(22px, 5.5vw, 28px); }
  .destacados-main { padding: 56px 0 64px; }
  .destacados-head h2 { font-size: clamp(24px, 6vw, 32px); }
  .form-modal-box { padding: 28px 20px; }
  .form-modal-header h2 { font-size: 20px; }
  .lightbox-controls { bottom: 16px; gap: 2px; padding: 4px; }
  .lb-ctrl { width: 36px; height: 36px; font-size: 16px; }
  .lb-counter { font-size: 12px; padding: 0 10px; }
}

/* Móvil chico (320–480px) */
@media (max-width: 480px) {
  .wrap { padding: 0 16px; }
  .rubro-products-list li { padding: 11px 0 11px 24px; font-size: 14px; }
  .rubro-text h2 { font-size: 26px; line-height: 1.2; }
  .rubro-carousel-head h2 { font-size: 22px; }
  .destacados-head h2 { font-size: 24px; }
  .destacados-head p { font-size: 14px; }
  .carousel-track { gap: 10px; }
  .carousel-arrow { width: 40px; height: 40px; }
  .carousel-arrow svg { width: 18px; height: 18px; }
  .lightbox-prev, .lightbox-next { width: 40px; height: 40px; }
  .lightbox-prev { left: 8px; } .lightbox-next { right: 8px; }
  .lightbox-close { width: 38px; height: 38px; top: 12px; right: 12px; }
}

/* Móvil ultra chico (<360px) */
@media (max-width: 360px) {
  .wrap { padding: 0 12px; }
  .rubro-text h2, .destacados-head h2, .rubro-carousel-head h2 { font-size: 22px; }
  .form-modal-box { padding: 24px 16px; }
  .destacados-card { width: 280px !important; }
  .carousel-arrow { width: 36px; height: 36px; }
}

/* Reducir movimiento si el usuario lo prefiere */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
  .rubro-collage .cg { opacity: 1 !important; transform: none !important; }
  .destacados-card { transition: none !important; }
}

/* Modo paisaje en mobile: bajar altura del destacados-stage */
@media (max-height: 480px) and (orientation: landscape) {
  .destacados-stage { height: 320px; }
  .destacados-card { width: 320px; }
}
