/* Sustituir las rutas por los archivos de fuentes disponibles. */
@font-face {
  font-family: "IberPangea";
  src: url("/ibdmedia/ibdcomes/hogares/fonts/IberPangea-SmBold.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "IberPangea Text";
  src: url("/ibdmedia/ibdcomes/hogares/fonts/IberPangeaText-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

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

.plan-module {
  --content-width: 100%;
  --side-padding: 16px;
  --swiper-offset: 16px;
  --gap: 24px;
  --radius: 16px;
  --text-color: #2c2c2c;
  --green-surface: #dcebe1;
  --neutral-surface: #f9f9f9;
  --warm-surface: #fff5ec;
  --control-color: #2f6852;

  width: 100%;
  padding: 40px var(--side-padding);
  color: var(--text-color);
  background: #fff;
  /*
   * overflow: hidden en la sección para recortar el "peek" del slide
   * sin limitar el ancho del container interior.
   */
  overflow: hidden;
}

.plan-module__container {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  width: 100%;
  max-width: var(--content-width);
  margin-inline: auto;
}

.plan-module__title {
  margin: 0;
  text-align: center;
  padding-bottom: 0rem;
}

/* ─── Swiper: contenedor del carrusel ─────────────────────────────────────── */

.plan-module__swiper {
  /*
   * Usamos --swiper-offset (fijo a 16px siempre) para el truco del margen
   * negativo. Así el swiper arranca desde el borde izquierdo del padding base
   * independientemente de que --side-padding sea mayor en breakpoints superiores.
   */
  width: calc(100% + var(--swiper-offset));
  margin-left: calc(-1 * var(--swiper-offset));
  padding-left: var(--swiper-offset);
  overflow: visible;
  box-sizing: border-box;
}

/* El wrapper estira todos los slides a la misma altura */
.plan-module__swiper .swiper-wrapper {
  align-items: stretch;
}

/* Cada slide ocupa 90% del ancho visible → el siguiente se asoma ~10% */
.plan-module__swiper .swiper-slide {
  width: 90%;
  height: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

/* La tarjeta se estira para ocupar todo el alto del slide */
.plan-module__swiper .swiper-slide > .plan-card {
  flex: 1 1 auto;
  height: 100%;
}

.plan-module__column--double {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  height: 100%;
}

/* ─── Tarjetas ────────────────────────────────────────────────────────────── */
.plan-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--gap);
  padding: 24px;
  border: 0;
  border-radius: var(--radius);
  background: var(--neutral-surface);
  box-shadow: none;
  overflow: hidden;
}

.plan-card--green {
  background: var(--green-surface);
}

.plan-card--saving {
  flex: 1;
  min-height: 180px;
}

.plan-card--freedom {
  background: var(--warm-surface);
}

.plan-card__copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plan-card__title {
  margin: 0;
  text-align: left;
  padding-bottom: 0rem;
}

.plan-card__description {
  margin: 0;
  text-align: left;
}

/* Conserva el espacio de los bloques de texto observado en Figma. */
.plan-card--green .plan-card__description {
  min-height: 66px;
}

.plan-card--saving .plan-card__title {
  min-height: 64px;
}

.plan-card--freedom .plan-card__description {
  min-height: 44px;
}

.plan-card--energy .plan-card__description {
  min-height: 66px;
}

.plan-card__image {
  display: block;
  flex: 0 0 180px;
  width: 100%;
  height: 180px;
  border-radius: var(--radius);
  object-fit: cover;
  object-position: center;
}

/* ─── Controles Swiper: carousel-group ───────────────────────────────────── */

.carousel-group {
  /* Colores */
  --carousel-bg: #ffffff;
  --carousel-border: #c8d9d0;
  --carousel-icon: #2f6852;
  --carousel-hover-bg: #fffaf6;
  --carousel-hover-icon: #00402a;
  --carousel-dot-border: #2f6852;
  --carousel-dot-hover: #00402a;
  --carousel-dot-selected: #007f33;
  --carousel-disabled: #bfbfbf;
  --carousel-pressed-ring: #5bd38c;
  --carousel-focus: #007acb;

  display: inline-flex;
  align-items: center;
  gap: 16px;
  width: max-content;
  height: 32px;
  padding: 0;
  margin: 0 auto;
  border: 0;
  background: transparent;
  overflow: visible;
}

.carousel-group,
.carousel-group * {
  box-sizing: border-box;
}

/* Reset de botones dentro del grupo */
.carousel-group :where(.carousel-control, .carousel-dot) {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ── Flechas ── */
.carousel-group .carousel-control {
  width: 32px;
  height: 32px;
  border-radius: 100px;
  color: var(--carousel-icon);
  background: var(--carousel-bg);
  box-shadow: inset 0 0 0 1px var(--carousel-border);
  overflow: visible;
}

/* Anulamos el ::after que Swiper pueda inyectar */
.carousel-group .carousel-control::after,
.carousel-group .carousel-control::before {
  display: none;
}

.carousel-control svg {
  display: block;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  pointer-events: none;
}

/* Hover */
.carousel-group .carousel-control:where(:not(:disabled):hover) {
  color: var(--carousel-hover-icon);
  background: var(--carousel-hover-bg);
}

/* Pressed */
.carousel-group .carousel-control:where(:not(:disabled):active) {
  color: var(--carousel-hover-icon);
  background: var(--carousel-hover-bg);
  box-shadow:
    inset 0 0 0 1px var(--carousel-border),
    0 0 0 1px var(--carousel-pressed-ring);
}

/* Focus */
.carousel-group .carousel-control:where(:not(:disabled):focus-visible) {
  color: var(--carousel-icon);
  background: var(--carousel-bg);
  outline: 3px solid var(--carousel-focus);
  outline-offset: 2px;
}

/* Disabled (Swiper añade .swiper-button-disabled a través de JS) */
.carousel-group .carousel-control:disabled,
.carousel-group .carousel-control.swiper-button-disabled {
  color: var(--carousel-disabled);
  background: var(--carousel-bg);
  box-shadow: inset 0 0 0 1px var(--carousel-disabled);
  opacity: 1;
  cursor: default;
  pointer-events: none;
}

/* ── Contenedor de dots ── */
.carousel-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  width: max-content;
  height: 32px;
  padding: 4px;
  border: 0;
  border-radius: 100px;
  background: var(--carousel-bg);
  box-shadow: inset 0 0 0 1px var(--carousel-border);
  overflow: visible;
}

/* ── Dots (Swiper genera .swiper-pagination-bullet) ── */

/* Reset completo de los estilos por defecto de Swiper sobre los bullets */
.carousel-dots .swiper-pagination-bullet {
  display: grid !important;
  place-items: center !important;
  width: 24px !important;
  height: 24px !important;
  /* Sin border-radius en el área de toque: el círculo lo da el ::before */
  border-radius: 0 !important;
  /* Anula cualquier border que inyecte una hoja de estilos externa de Swiper */
  border: 0 !important;
  background: transparent !important;
  opacity: 1 !important;
  margin: 0 !important;
  cursor: pointer;
  /* Eliminar cualquier outline/box-shadow que Swiper pueda añadir */
  outline: none;
  box-shadow: none !important;
}

/* Círculo interior del dot */
.carousel-dots .swiper-pagination-bullet::before {
  content: "";
  display: block;
  width: 11px;
  height: 11px;
  box-sizing: border-box;
  border: 1px solid var(--carousel-dot-border);
  border-radius: 50%;
  background: transparent;
  pointer-events: none;
}

/* Anular el ::after que Swiper pueda inyectar */
.carousel-dots .swiper-pagination-bullet::after {
  display: none !important;
}

/* Hover dot no activo */
.carousel-dots .swiper-pagination-bullet:where(:not(.swiper-pagination-bullet-active):hover)::before {
  border-color: var(--carousel-dot-hover);
}

/* Dot activo: círculo relleno */
.carousel-dots .swiper-pagination-bullet-active::before {
  width: 10px;
  height: 10px;
  border: 0;
  background: var(--carousel-dot-selected);
}

/* En 768px ocultamos el tercer dot */
@media (min-width: 768px) {
  .carousel-dots .swiper-pagination-bullet:nth-child(3) {
    display: none;
  }
}

/* En desktop (≥992px) ocultamos el grupo entero */
@media (min-width: 992px) {
  .carousel-group {
    display: none;
  }
}

/* ─── Breakpoints ─────────────────────────────────────────────────────────── */

/* 576 px */
@media (min-width: 576px) {
  .plan-module {
    --side-padding: 42px;
    /*
     * --swiper-offset se mantiene a 16px: el swiper sigue arrancando desde
     * el borde del padding base. El --side-padding mayor solo afecta al
     * padding del módulo (título, controles), no al ancho del swiper.
     */
  }

  /*
   * Con el swiper anclado a 16px de margen, el ancho útil es viewport - 16px.
   * width: 60% → card más estrecha como en Figma, segunda card visible ~40%.
   */
  .plan-module__swiper .swiper-slide {
    width: 60%;
  }
}

/* 768 px: dos cards completas + peek de la tercera */
@media (min-width: 768px) {
  .plan-module {
    --side-padding: 48px;
    --swiper-offset: 16px;
  }

  /*
   * Cálculo: viewport 768px, padding visible 48px a cada lado → área visible 720px.
   * 2 cards + gap 16px + peek ~40px → cada card ≈ 332px → 332/768 ≈ 43%.
   * El swiper ocupa viewport completo (el offset solo desplaza el origen),
   * así que el % se calcula sobre el viewport real.
   */
  .plan-module__swiper .swiper-slide {
    width: 43%;
  }
}

/* 992 px: pasa a tres columnas con CSS Grid (Swiper desactivado vía JS) */
@media (min-width: 992px) {
  .plan-module {
    --content-width: 828px;
    --side-padding: 82px;
    overflow: visible;
  }



  /* En desktop reseteamos el truco de margen negativo y el offset: ya no hay carrusel */
  .plan-module__swiper {
    width: 100%;
    margin-left: 0;
    padding-left: 0;
    --swiper-offset: 0px;
  }

  /* En desktop el swiper-wrapper actúa como grid de 3 columnas */
  .plan-module__swiper .swiper-wrapper {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;   /* todas las celdas del grid a la misma altura */
    gap: var(--gap);
    transform: none !important;
  }

  .plan-module__swiper .swiper-slide {
    width: auto;
    height: auto;
    display: flex;
    flex-direction: column;
  }

  /* La card se estira para ocupar todo el alto del slide (grid lo iguala) */
  .plan-module__swiper .swiper-slide > .plan-card {
    flex: 1 1 auto;
    height: 100%;
  }

  .plan-card--green .plan-card__description {
    min-height: 88px;
  }

  .plan-card--freedom .plan-card__description {
    min-height: 66px;
  }

  .plan-card--energy .plan-card__description {
    min-height: 88px;
  }
}

/* 1200 px */
@media (min-width: 1200px) {
  .plan-module {
    --content-width: 996px;
    --side-padding: 102px;
    overflow: visible;
  }



  .plan-card--green .plan-card__description {
    min-height: 66px;
  }

  .plan-card--freedom .plan-card__description {
    min-height: 44px;
  }

  .plan-card--energy .plan-card__description {
    min-height: 66px;
  }
}

/* 1920 px */
@media (min-width: 1920px) {
  .plan-module {
    --content-width: 1272px;
    --side-padding: 324px;
    overflow: visible;
  }

  .plan-card--green .plan-card__description {
    min-height: 44px;
  }

  .plan-card--saving {
    min-height: 202px;
  }
}
