/* Cards de serviços – União Brasil (carrossel no celular, grade no desktop) */
/* ====================== CARROSSEL ====================== */
  .ub-carousel {
    --ub-dark: #00004c;
    --ub-red: #e30613;
    --ub-card-h: 460px;          /* altura do card */
    --ub-radius: 22px;
    --ub-gap: 24px;              /* espaço entre os cards */
    --ub-per-view: 1.15;         /* CELULAR: cards visíveis por vez (o "0.15" mostra um pedaço do próximo = convite para deslizar) */

    position: relative;
    width: 100%;
  }
  .ub-carousel *, .ub-carousel *::before, .ub-carousel *::after { box-sizing: border-box; }

  /* ---------- DESKTOP / TABLET: grade igual à anterior ---------- */
  .ub-carousel__track {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--ub-gap);
  }
  @media (max-width: 1100px) { .ub-carousel__track { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  .ub-carousel__nav { display: none; }

  /* ---------- CELULAR (até 767px): carrossel ---------- */
  @media (max-width: 767px) {
    .ub-carousel { --ub-gap: 16px; --ub-card-h: 380px; }
    .ub-carousel__track {
      display: flex;
      overflow-x: auto;
      overflow-y: hidden;
      scroll-snap-type: x mandatory;
      scroll-behavior: smooth;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior-x: contain;
      scrollbar-width: none;                     /* esconde a barra (Firefox) */
      padding: 20px 0;                           /* folga para a sombra dos cards */
      margin: -20px 0;
      outline: none;
    }
    .ub-carousel__track::-webkit-scrollbar { display: none; }   /* esconde a barra (Chrome/Safari) */
    .ub-carousel__track.is-dragging { scroll-snap-type: none; scroll-behavior: auto; }
    .ub-carousel__track.is-dragging a { pointer-events: none; }
    .ub-carousel__track img { -webkit-user-drag: none; user-select: none; }
    .ub-carousel__track > .ub-tilt {
      flex: 0 0 calc((100% - (var(--ub-per-view) - 1) * var(--ub-gap)) / var(--ub-per-view));
      scroll-snap-align: start;
    }
    .ub-carousel__nav { display: flex; }
  }

  /* ---------- Navegação ---------- */
  .ub-carousel__nav {
    align-items: center;
    gap: 24px;
    margin-top: 32px;
  }
  .ub-carousel__progress {
    position: relative;
    flex: 1;
    height: 3px;
    border-radius: 3px;
    background: rgba(0, 0, 76, .12);
    overflow: hidden;
  }
  .ub-carousel__bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 30%;
    border-radius: inherit;
    background: var(--ub-dark);
    transition: transform .15s linear;
  }
  .ub-carousel__arrows { display: flex; gap: 10px; }
  .ub-carousel__btn {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 76, .18);
    background: #fff;
    color: var(--ub-dark);
    cursor: pointer;
    transition: background .25s ease, color .25s ease, border-color .25s ease, opacity .25s ease;
  }
  .ub-carousel__btn:hover:not(:disabled),
  .ub-carousel__btn:focus-visible {
    background: var(--ub-red);
    border-color: var(--ub-red);
    color: #fff;
    outline: none;
  }
  .ub-carousel__btn:disabled { opacity: .35; cursor: default; }
  @media (max-width: 640px) {
    .ub-carousel__nav { margin-top: 24px; gap: 16px; }
    .ub-carousel__btn { width: 42px; height: 42px; }
  }

  /* ====================== CARDS ====================== */

  .ub-tilt-grid *, .ub-tilt-grid *::before, .ub-tilt-grid *::after { box-sizing: border-box; }

  /* ---------- Container (figure) ---------- */
  .ub-tilt {
    position: relative;
    margin: 0;
    height: var(--ub-card-h);
    perspective: 800px;
    z-index: 1;
  }
  .ub-tilt:hover { z-index: 5; }   /* card em hover (e o balão) fica acima dos vizinhos */

  /* ---------- Parte que inclina ---------- */
  .ub-tilt__inner {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: var(--ub-radius);
    transform-style: preserve-3d;
    will-change: transform;
    background: linear-gradient(160deg, #1a1a7a, var(--ub-dark)); /* aparece se a imagem não carregar */
    box-shadow: 0 18px 40px rgba(0, 0, 76, .18);
  }

  /* Seletor reforçado + !important: o Elementor aplica ".elementor img { border-radius: 0 }",
     que é mais forte que a classe sozinha e deixava a foto com cantos retos */
  .ub-tilt-grid .ub-tilt__img {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    object-fit: cover;
    border-radius: var(--ub-radius) !important;
    clip-path: inset(0 round var(--ub-radius));   /* garante o recorte arredondado também durante a inclinação 3D */
    transform: translateZ(0);
    color: transparent;            /* esconde o texto alt se a imagem falhar */
  }

  /* ---------- Carregamento das fotos ----------
     Enquanto a foto baixa, o card mostra um brilho suave passando (em vez de um bloco vazio);
     quando termina, a foto aparece com fade. Só ativa se o JS rodar (classe ub-img-js). */
  .ub-img-js .ub-tilt__inner::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: inherit;
    background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .10) 50%, transparent 70%) 0 0 / 220% 100%;
    animation: ub-shimmer 1.4s linear infinite;
    pointer-events: none;
  }
  .ub-img-js .ub-tilt.is-loaded .ub-tilt__inner::after { animation: none; opacity: 0; }
  @keyframes ub-shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
  .ub-img-js .ub-tilt-grid .ub-tilt__img { opacity: 0; transition: opacity .6s ease; }
  .ub-img-js .ub-tilt-grid .ub-tilt.is-loaded .ub-tilt__img { opacity: 1; }

  /* ---------- Conteúdo por cima da imagem ---------- */
  .ub-tilt__overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 26px;
    border-radius: var(--ub-radius);
    color: #fff;
    /* degradê azul para garantir leitura sobre qualquer foto */
    background: linear-gradient(to top, rgba(0, 0, 76, .95) 0%, rgba(0, 0, 76, .7) 38%, rgba(0, 0, 76, .1) 72%, rgba(0, 0, 76, 0) 100%);
    transform: translateZ(30px);   /* "flutua" acima da imagem na inclinação */
    transform-style: preserve-3d;  /* permite profundidade própria em cada camada */
  }

  /* Camadas com parallax próprio (título, descrição e botão) */
  .ub-tilt__title,
  .ub-tilt__desc,
  .ub-tilt__cta {
    will-change: transform;
  }


  .ub-tilt__title {
    margin: 0 0 8px;
    font-size: clamp(20px, 1.5vw, 24px);
    font-weight: 600;
    line-height: 1.2;
    color: #fff;
  }

  .ub-tilt__desc {
    margin: 0 0 18px;
    font-size: 15px;
    line-height: 1.5;
    color: rgba(255, 255, 255, .82);
  }

  /* ---------- Botão "Saiba mais" – padrão de botão União Brasil (variação vidro) ----------
     A caixinha do ícone se expande e preenche o botão inteiro no hover. */
  .ub-tilt__cta {
    --cta-bg: rgba(255, 255, 255, .14);        /* fundo do botão */
    --cta-border: rgba(255, 255, 255, .35);    /* borda */
    --cta-color: #fff;                         /* texto */
    --cta-icon-bg: #fff;                       /* caixinha (é ela que se expande) */
    --cta-icon-color: #00004c;                 /* ícone */
    --cta-color-hover: #00004c;                /* texto com a caixinha expandida */
    --cta-icon-size: 36px;
    --cta-pad: 6px;
    --cta-radius: 10px;
    --cta-speed: .5s;

    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    align-self: stretch;
    padding: var(--cta-pad) var(--cta-pad) var(--cta-pad) 18px;
    border: 0;
    border-radius: var(--cta-radius);
    background-color: var(--cta-bg);
    box-shadow: inset 0 0 0 1px var(--cta-border);
    -webkit-backdrop-filter: blur(6px);
            backdrop-filter: blur(6px);
    color: var(--cta-color) !important;
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    font-weight: 500;
    line-height: 1;
    text-decoration: none !important;
    transition: color .35s ease, background-color 0s linear 0s;
  }
  /* caixinha do ícone: camada que cresce até cobrir o botão */
  .ub-tilt__cta::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: calc(50% - var(--cta-icon-size) / 2);
    right: var(--cta-pad);
    width: var(--cta-icon-size);
    height: var(--cta-icon-size);
    border-radius: 8px;
    background: var(--cta-icon-bg);
    transition:
      top var(--cta-speed) cubic-bezier(.65, 0, .35, 1),
      right var(--cta-speed) cubic-bezier(.65, 0, .35, 1),
      width var(--cta-speed) cubic-bezier(.65, 0, .35, 1),
      height var(--cta-speed) cubic-bezier(.65, 0, .35, 1),
      border-radius var(--cta-speed) cubic-bezier(.65, 0, .35, 1);
  }
  .ub-tilt__cta-ico {
    display: grid;
    place-items: center;
    flex: none;
    width: var(--cta-icon-size);
    height: var(--cta-icon-size);
    color: var(--cta-icon-color);
    transition: transform .35s ease;
  }
  .ub-tilt__cta:hover,
  .ub-tilt__cta:focus-visible {
    color: var(--cta-color-hover) !important;
    background-color: var(--cta-icon-bg);
    transition: color .35s ease, background-color .1s linear calc(var(--cta-speed) * .9);
    outline: none;
  }
  .ub-tilt__cta:hover::before,
  .ub-tilt__cta:focus-visible::before {
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    border-radius: var(--cta-radius);
  }
  .ub-tilt__cta:hover .ub-tilt__cta-ico,
  .ub-tilt__cta:focus-visible .ub-tilt__cta-ico { transform: translateX(3px); }
  @media (prefers-reduced-motion: reduce) { .ub-tilt__cta { --cta-speed: .01s; } }

  /* ---------- Balão que segue o mouse ---------- */
  .ub-tilt__caption {
    pointer-events: none;
    position: absolute;
    left: 0;
    top: 0;
    z-index: 3;
    padding: 5px 11px;
    border-radius: 6px;
    background: #fff;
    color: var(--ub-dark);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    will-change: transform, opacity;
  }

  /* Touch / celular: sem balão */
  @media (hover: none), (max-width: 640px) {
    .ub-tilt__caption { display: none; }
  }
