/* Faixa do Instagram (custom_views/components/renders/instagramfeed.phtml).
   Linkado pelo layout com ?v=filemtime (o servidor manda CSS com cache
   immutable de 1 ano: sem a versao, a edicao nao chega ao navegador).
   Usa os tokens do assets/css/style.css (--navy, --soft, --yellow, --radius...). */

.instafeed {
  --ig: linear-gradient(45deg, #f9ce34 0%, #ee2a7b 50%, #6228d7 100%);
  position: relative;
  overflow: hidden;
  background: #fff;
}

.instafeed[hidden] {
  display: none;
}

/* Bolhas suaves no fundo, no clima do tema (amarelo da marca + lilas do IG) */
.instafeed:before,
.instafeed:after {
  content: '';
  position: absolute;
  z-index: 0;
  border-radius: 50%;
  filter: blur(60px);
  opacity: .35;
  pointer-events: none;
}

.instafeed:before {
  width: 360px;
  height: 360px;
  top: -140px;
  right: -80px;
  background: #ffd9ec;
}

.instafeed:after {
  width: 300px;
  height: 300px;
  bottom: -160px;
  left: -60px;
  background: #ffe7a3;
}

.instafeed > * {
  position: relative;
  z-index: 1;
}

/* ------------------------------------------------------------ cabecalho --- */

.instafeed-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 34px;
}

.instafeed-perfil {
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
}

.instafeed-perfil .eyebrow {
  margin-bottom: 8px;
}

.instafeed-perfil h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3.2vw, 2.4rem);
  overflow-wrap: anywhere;
}

.instafeed-sub {
  margin: 6px 0 0;
  font-size: 1rem;
  color: var(--muted);
}

/* Anel em degrade do Instagram em volta do icone */
.instafeed-avatar {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  padding: 3px;
  border-radius: 50%;
  background: var(--ig);
  box-shadow: 0 14px 30px -14px #ee2a7b88;
}

.instafeed-avatar > span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
}

.instafeed-avatar svg {
  width: 30px;
  height: 30px;
}

.instafeed-acoes {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.instafeed-seta {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--navy);
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s, opacity .2s;
}

.instafeed-seta svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.instafeed-seta:hover:not(:disabled) {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.instafeed-seta:disabled {
  opacity: .35;
  cursor: default;
}

.instafeed-seguir {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  margin-left: 6px;
  padding: 0 24px;
  border-radius: 99px;
  background: var(--ig);
  color: #fff;
  font-weight: 800;
  font-size: .9375rem;
  box-shadow: 0 12px 26px -14px #ee2a7b;
  transition: transform .2s, box-shadow .2s;
}

.instafeed-seguir svg {
  width: 18px;
  height: 18px;
}

.instafeed-seguir:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px -14px #ee2a7b;
}

/* --------------------------------------------------------------- faixa --- */

/* Rolagem nativa com encaixe: 4 por vez no computador, o resto rola com as
   setas, o trackpad ou o dedo. Sem Swiper. O padding da espaco para a sombra
   e o zoom do hover nao serem cortados pelo overflow. */
.instafeed-faixa {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 3 * 20px) / 4);
  gap: 20px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding: 8px 4px 24px;
  margin: -8px -4px -24px;
}

.instafeed-faixa::-webkit-scrollbar {
  display: none;
}

.instafeed-faixa:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 4px;
  border-radius: var(--radius);
}

.instafeed-post {
  position: relative;
  display: block;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--soft);
  scroll-snap-align: start;
  box-shadow: 0 16px 34px -24px #17254380;
  transition: transform .3s ease, box-shadow .3s ease;
}

.instafeed-post img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform .5s ease;
}

/* Hover: veu azul da marca + icone do Instagram no centro */
.instafeed-post:before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, #17254300 30%, #172543cc 100%);
  opacity: 0;
  transition: opacity .3s;
}

.instafeed-post:after {
  content: '';
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  background: #fff;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='3' width='18' height='18' rx='5' fill='none' stroke='%23000' stroke-width='2'/%3E%3Ccircle cx='12' cy='12' r='4' fill='none' stroke='%23000' stroke-width='2'/%3E%3Ccircle cx='17.3' cy='6.7' r='1.2'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='3' width='18' height='18' rx='5' fill='none' stroke='%23000' stroke-width='2'/%3E%3Ccircle cx='12' cy='12' r='4' fill='none' stroke='%23000' stroke-width='2'/%3E%3Ccircle cx='17.3' cy='6.7' r='1.2'/%3E%3C/svg%3E") center / contain no-repeat;
  opacity: 0;
  transform: scale(.7);
  transition: opacity .3s, transform .3s;
}

.instafeed-post:hover,
.instafeed-post:focus-visible {
  transform: translateY(-6px);
  box-shadow: 0 24px 40px -24px #172543aa;
}

.instafeed-post:hover img,
.instafeed-post:focus-visible img {
  transform: scale(1.06);
}

.instafeed-post:hover:before,
.instafeed-post:focus-visible:before,
.instafeed-post:hover:after,
.instafeed-post:focus-visible:after {
  opacity: 1;
}

.instafeed-post:hover:after,
.instafeed-post:focus-visible:after {
  transform: scale(1);
}

/* ----------------------------------------------------------- responsivo --- */

@media (max-width: 960px) {
  .instafeed-faixa {
    grid-auto-columns: calc((100% - 2 * 16px) / 3);
    gap: 16px;
  }
}

@media (max-width: 760px) {
  .instafeed-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 26px;
  }

  .instafeed-acoes {
    width: 100%;
  }

  /* No celular rola no dedo: sem setas, botao Seguir na largura toda */
  .instafeed-seta {
    display: none;
  }

  .instafeed-seguir {
    flex: 1;
    justify-content: center;
    margin: 0;
  }

  .instafeed-avatar {
    width: 64px;
    height: 64px;
  }

  .instafeed-avatar svg {
    width: 26px;
    height: 26px;
  }
}

/* 2 e um pedaco do 3o: o corte mostra que a faixa rola */
@media (max-width: 600px) {
  .instafeed-faixa {
    grid-auto-columns: 44%;
    gap: 12px;
  }

  .instafeed-post {
    border-radius: 20px;
  }

  .instafeed-perfil {
    gap: 14px;
  }
}
