/* Insurance carousel (home page).
 * Vertical Swiper. Each slide fills the full Impreza section height (100vh)
 * so there is no white gap below. Content inside is compressed to fit all
 * slides — including "Seguros de Ahorro" with its 7 links — without overflow.
 *
 * All `!important` markers are deliberate: they beat the Swiper bundle's
 * default `.swiper-pagination-vertical` / `.swiper-pagination-bullet` rules
 * that get applied at runtime when Swiper adds those classes to our nodes.
 */

/* Pinned / scroll-controlled carousel.
 *
 * The outer .eis-section is a tall "scroll runway" — 1 viewport per slide plus
 * a bit. The inner .eis-swiper is sticky to the top of the viewport, so as the
 * user scrolls past the section the carousel stays pinned while the page scroll
 * position drives which slide is shown. After scrolling past the runway, the
 * page continues normally. Same in reverse going up.
 *
 * Each slide gets ~100vh of scroll runway, which feels about right for reading
 * the content before advancing. Tune the `height` below to taste.
 */
.eis-section {
  position: relative;
  background: rgba(241, 243, 245, 1);
  height: 300vh; /* numSlides * 100vh — keep in sync with the slide count */
}

.eis-swiper {
  position: sticky;
  top: 0;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

.eis-swiper .swiper-wrapper {
  height: 100%;
}

/* Clip any content overflow so adjacent slides can never bleed through. */
.eis-swiper .swiper-slide {
  height: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

/* Every wrapper from .swiper-slide down to the columns is 100% height so the
 * right-hand image column can stretch top-to-bottom. */
.eis-swiper .home-slide,
.eis-swiper .home-slide > .l-section-h,
.eis-swiper .home-slide .g-cols.cols_2 {
  height: 100%;
  min-height: 0;
}

/* --- Column proportions (text ~72% / image ~28%) ------------------------ */
.eis-swiper .home-slide .g-cols.cols_2 {
  display: grid;
  grid-template-columns: 72% 28%;
  align-items: stretch;
  gap: 0;
}

.eis-swiper .home-slide .wpb_column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
}

/* Left text column: vertically centered, generous left padding for the
 * pagination indicator, right padding for breathing room before the image. */
.eis-swiper .home-slide .content-column {
  justify-content: center;
}

.eis-swiper .home-slide .content-column .vc_column-inner {
  max-width: 760px;
  margin: 0;
  padding: 32px 60px 32px 140px;
  width: 100%;
  box-sizing: border-box;
}

/* Right image column: edge-to-edge, image fills 100% width and height. */
.eis-swiper .home-slide .wpb_column.stretched .vc_column-inner {
  padding: 0;
  height: 100%;
  display: flex;
  flex: 1 1 auto;
}

.eis-swiper .home-slide .w-image,
.eis-swiper .home-slide .w-image-h {
  height: 100%;
  width: 100%;
  display: block;
}

.eis-swiper .home-slide .w-image-h img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  display: block;
  max-width: none !important;
}

/* --- Compressed content rhythm ------------------------------------------
 * The "Seguros de Ahorro" slide has 7 product links and must fit in 100vh.
 * We shrink the heading + tighten the link list to make it work on viewports
 * down to roughly 720px tall. The look is intentionally more horizontal /
 * dense than the original /home-slider/ page.
 */

.eis-swiper .home-slide .text-with-dot {
  margin: 0 0 16px !important;
}

.eis-swiper .home-slide h2 {
  font-size: 2.6rem;
  line-height: 1.1;
  margin: 0 0 14px;
}

.eis-swiper .home-slide .wpb_text_column p {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
}

.eis-swiper .home-slide .gold-text-with-line {
  margin: 24px 0 16px !important;
}

/* Override the global .home-slide-links rules (style.css lines 1190–1254)
 * with tighter spacing and a smaller link font, scoped to the carousel only. */
.eis-swiper .home-slide-links .w-text {
  padding-bottom: 10px !important;
  margin-bottom: 10px !important;
}

.eis-swiper .home-slide-links .w-text:last-of-type {
  padding-bottom: 0 !important;
  margin-bottom: 0 !important;
}

.eis-swiper .home-slide-links a {
  font-size: 18px !important;
  line-height: 1.45 !important;
}

/* --- Vertical pagination (left edge) ------------------------------------
 * Three hairline bars stacked. Active is darker + ~1.6× taller. The
 * `!important` flags beat Swiper's runtime `.swiper-pagination-vertical`
 * defaults (which would otherwise put the bullets on the right).
 */
.eis-swiper .eis-pagination {
  position: absolute !important;
  left: 64px !important;
  right: auto !important;
  top: 50% !important;
  bottom: auto !important;
  transform: translateY(-50%) !important;
  z-index: 10 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 18px !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
}

.eis-swiper .eis-pagination .swiper-pagination-bullet {
  width: 1px !important;
  height: 38px !important;
  border-radius: 0 !important;
  background: rgba(17, 54, 86, 0.28) !important;
  opacity: 1 !important;
  margin: 0 !important;
  transition: background 0.25s ease, height 0.25s ease, width 0.25s ease !important;
  cursor: pointer;
  display: block !important;
}

.eis-swiper .eis-pagination .swiper-pagination-bullet-active {
  background: var(--color-primary, #113656) !important;
  height: 60px !important;
  width: 2px !important;
}

/* --- Navigation buttons (up / down) -------------------------------------
 * Hidden in the pinned/scroll-controlled carousel because page scroll is
 * the only input. Kept in the markup for accessibility / future use.
 */
.eis-nav {
  display: none;
}

/* The original styling, kept for reference / re-enabling:
.eis-nav {
  position: absolute;
  z-index: 10;
  left: 40px;
  width: 42px;
  height: 42px;
  border: none;
  background: rgba(17, 54, 86, 0.55);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: background 0.2s ease;
  padding: 0;
}

.eis-nav:hover {
  background: rgba(17, 54, 86, 0.85);
}

.eis-prev {
  top: 40px;
}

.eis-next {
  bottom: 40px;
}

.eis-nav svg {
  width: 16px;
  height: 16px;
}

.eis-nav.swiper-button-disabled {
  opacity: 0.3;
  cursor: default;
}
*/

/* --- Responsive --------------------------------------------------------- */

@media screen and (max-width: 1280px) {
  .eis-swiper .home-slide .content-column .vc_column-inner {
    padding: 28px 40px 28px 110px;
    max-width: 640px;
  }
  .eis-swiper .home-slide h2 {
    font-size: 2.2rem;
  }
}

@media screen and (max-width: 1024px) {
  .eis-swiper .home-slide .g-cols.cols_2 {
    grid-template-columns: 68% 32%;
  }
  .eis-swiper .home-slide .content-column .vc_column-inner {
    padding: 24px 30px 24px 90px;
  }
}

/* Small tablet (768–900px): keep the pinned scroll-controlled carousel but
 * tighten the content (slightly wider image column, smaller heading and
 * link list font, less horizontal padding for the pagination). */
@media screen and (min-width: 768px) and (max-width: 900px) {
  .eis-section {
    height: 270vh; /* slightly shorter runway on small tablets */
  }
  .eis-swiper .home-slide .g-cols.cols_2 {
    grid-template-columns: 62% 38%;
  }
  .eis-swiper .home-slide .content-column .vc_column-inner {
    padding: 20px 24px 20px 72px;
    max-width: 480px;
  }
  .eis-swiper .home-slide h2 {
    font-size: 1.9rem;
  }
  .eis-swiper .home-slide-links a {
    font-size: 17px !important;
    line-height: 1.4 !important;
  }
  .eis-swiper .eis-pagination {
    left: 24px !important;
  }
}

/* Mobile (≤767px): SAME pinned scroll-controlled pattern as desktop, but
 * slides advance HORIZONTALLY (translateX) and the image is hidden so the
 * full slide height is available for the content (otherwise the Ahorro
 * slide's 7 links won't fit on small phones).
 */

@media screen and (max-width: 767px) {
  /* Mobile: container stays a single viewport tall (NO runway). Page scroll
   * events that happen *while the carousel is in viewport* are intercepted
   * by JS and translated into horizontal slide changes. Page scroll resumes
   * normally once the user has scrolled past the last slide (or back above
   * the first slide). No sticky / no fixed positioning needed — just a
   * regular 100vh block in the page flow.
   */
  .eis-section {
    height: 100vh;
    background: rgba(241, 243, 245, 1);
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }
  .eis-swiper {
    position: relative;
    top: auto;
    height: 100%;
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
  }
  /* Constrain every nested element. Impreza's .l-section.width_custom uses
   * --site-content-width (set inline to 1300px) to size .l-section-h via
   * `min-width: var(--site-content-width)` — that's wider than any phone
   * viewport and was forcing the content to overflow. Resetting the variable
   * + clearing any min-width / left+right padding on every intermediate
   * container fixes it. */
  .eis-swiper .home-slide {
    --site-content-width: 100% !important;
  }
  .eis-section *,
  .eis-section *::before,
  .eis-section *::after {
    box-sizing: border-box;
  }
  .eis-swiper .swiper-slide,
  .eis-swiper .home-slide,
  .eis-swiper .home-slide .l-section-h,
  .eis-swiper .home-slide .g-cols,
  .eis-swiper .home-slide .wpb_column,
  .eis-swiper .home-slide .vc_column-inner {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  .eis-swiper .swiper-slide {
    width: 100vw !important;
    max-width: 100vw !important;
    flex-shrink: 0;
  }
  /* Horizontal-mode swiper wrapper. Swiper sets these at init via
   * direction:'horizontal', but pin them so CSS wins regardless. */
  .eis-swiper .swiper-wrapper {
    height: 100%;
    flex-direction: row;
  }
  .eis-swiper .swiper-slide {
    width: 100%;
    height: 100%;
    flex-shrink: 0;
    overflow: hidden;
  }

  /* Stack image-on-top + content-below within each slide.
   * Image: ~30% of slide height (visual anchor).
   * Content: ~70% with bottom padding to clear the pagination.
   * Content overflow-y is `auto` as a safety net for slide 2 (Ahorro,
   * 7 links) on very short viewports (iPhone SE = 568px tall). */
  .eis-swiper .home-slide,
  .eis-swiper .home-slide > .l-section-h,
  .eis-swiper .home-slide .g-cols.cols_2 {
    height: 100%;
  }
  .eis-swiper .home-slide .g-cols.cols_2 {
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
    grid-template-rows: none;
  }
  .eis-swiper .home-slide .wpb_column {
    display: flex;
    flex-direction: column;
    width: 100%;
  }
  /* Image column = top 30% */
  .eis-swiper .home-slide .wpb_column.stretched {
    order: -1; /* puts image first inside the flex column */
    flex: 0 0 30%;
    height: 30%;
    min-height: 0;
  }
  .eis-swiper .home-slide .wpb_column.stretched .vc_column-inner {
    padding: 0 !important;
    height: 100%;
    width: 100% !important;
    max-width: 100% !important;
    display: block;
  }
  .eis-swiper .home-slide .w-image,
  .eis-swiper .home-slide .w-image-h {
    height: 100% !important;
    width: 100% !important;
    display: block;
    max-width: 100% !important;
  }
  .eis-swiper .home-slide .w-image-h img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    display: block;
    max-width: 100% !important;
  }
  /* Content column = bottom 70% */
  .eis-swiper .home-slide .wpb_column.content-column {
    flex: 1 1 70%;
    min-height: 0;
    justify-content: flex-start;
  }
  .eis-swiper .home-slide .content-column .vc_column-inner {
    max-width: none !important;
    padding: 20px 22px 56px 22px !important; /* bottom padding clears the pagination */
    width: 100% !important;
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Compact typography so even slide 2's 7 links fit comfortably. */
  .eis-swiper .home-slide .text-with-dot {
    margin: 0 0 12px !important;
    font-size: 11px;
  }
  .eis-swiper .home-slide h2 {
    font-size: 1.6rem;
    line-height: 1.2;
    margin: 0 0 12px;
  }
  .eis-swiper .home-slide .wpb_text_column p {
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
  }
  .eis-swiper .home-slide .gold-text-with-line {
    margin: 20px 0 12px !important;
    font-size: 11px;
  }
  .eis-swiper .home-slide-links a {
    font-size: 15px !important;
    line-height: 1.3 !important;
    text-decoration: none !important;
  }
  .eis-swiper .home-slide-links .w-text {
    padding-bottom: 9px !important;
    margin-bottom: 9px !important;
  }

  /* Pagination: horizontal hairline bars centred at the bottom. */
  .eis-swiper .eis-pagination {
    left: 50% !important;
    right: auto !important;
    top: auto !important;
    bottom: 22px !important;
    transform: translateX(-50%) !important;
    flex-direction: row !important;
    gap: 10px !important;
  }
  .eis-swiper .eis-pagination .swiper-pagination-bullet {
    width: 28px !important;
    height: 2px !important;
  }
  .eis-swiper .eis-pagination .swiper-pagination-bullet-active {
    width: 44px !important;
    height: 2px !important;
  }
}
