/* instagram.css — Secció Instagram de la portada: perfil, destacades,
   publicacions (fixes o automàtiques, vegeu instagram.js) i codi QR */
.instagram-section {
  width: 100%;
  padding: clamp(3rem, 8vw, 5rem) clamp(1rem, 4vw, 1.5rem);
}

.ig-card {
  --ig-gradient: linear-gradient(45deg, #f9ce34 0%, #ee2a7b 45%, #6228d7 100%);
  max-width: 980px;
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  border-radius: 32px;
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 30px 70px rgba(47, 47, 150, 0.12);
}

.ig-sr {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ── Perfil ── */
.ig-profile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: clamp(1rem, 4vw, 2.5rem);
  align-items: center;
}
.ig-profile__avatar {
  position: relative;
  width: clamp(88px, 14vw, 136px);
  aspect-ratio: 1;
  padding: 4px;
  border-radius: 50%;
  background: var(--ig-gradient);
  box-shadow: 0 12px 30px rgba(238, 42, 123, 0.25);
}
.ig-profile__avatar img {
  display: block;
  width: 100%;
  height: 100%;
  padding: 12%;
  border-radius: 50%;
  border: 4px solid #fff;
  background: #fff;
  object-fit: contain;
}
.ig-profile__info { min-width: 0; }
.ig-profile__eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
}
.ig-profile__eyebrow svg { width: 15px; height: 15px; flex-shrink: 0; }
.ig-profile__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
}
.ig-profile__user {
  margin: 0;
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(1.3rem, 3.2vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
  overflow-wrap: anywhere;
}
.ig-profile__follow {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.15rem;
  border-radius: 999px;
  background: var(--ig-gradient);
  color: #fff;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(238, 42, 123, 0.3);
}
.ig-profile__follow svg { width: 16px; height: 16px; flex-shrink: 0; }
.ig-profile__follow:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(238, 42, 123, 0.4); }
.ig-profile__follow:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

.ig-profile__stats {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0.7rem 0 0;
  padding: 0;
  font-size: 0.92rem;
  color: var(--text);
}
.ig-profile__stats[hidden], .ig-profile__stats li[hidden] { display: none; }
.ig-profile__stats strong { font-weight: 700; font-variant-numeric: tabular-nums; }
.ig-profile__name {
  margin: 0.7rem 0 0.1rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}
.ig-profile__bio {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text-light);
}
.ig-profile__chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.75rem 0 0;
  padding: 0;
}
.ig-profile__chips li {
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  background: rgba(47, 47, 150, 0.06);
  border: 1px solid rgba(47, 47, 150, 0.08);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--blue);
}

/* ── Codi QR ── */
.ig-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  width: 150px;
  padding: 0.75rem 0.75rem 0.85rem;
  border-radius: 20px;
  background: #fff;
  border: 1px solid rgba(47, 47, 150, 0.1);
  box-shadow: var(--shadow-md);
  text-align: center;
}
.ig-qr__img { display: block; width: 124px; height: 124px; }
.ig-qr__text { margin: 0; font-size: 0.72rem; font-weight: 600; line-height: 1.3; color: var(--text); }
.ig-qr__download {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(218, 26, 93, 0.35);
  text-underline-offset: 3px;
}
.ig-qr__download:hover { text-decoration-color: var(--accent); }
.ig-qr__download:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }

/* ── Destacades ── */
.ig-highlights {
  margin: clamp(1.5rem, 4vw, 2.25rem) calc(-1 * clamp(1.25rem, 4vw, 2.5rem)) 0;
  padding: 0 clamp(1.25rem, 4vw, 2.5rem);
  border-bottom: 1px solid rgba(47, 47, 150, 0.1);
}
.ig-highlights__list {
  list-style: none;
  display: flex;
  gap: clamp(0.75rem, 2.2vw, 1.6rem);
  margin: 0;
  padding: 0.25rem 0.25rem 1.4rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.ig-highlights__list::-webkit-scrollbar { display: none; }
.ig-highlights__list li { flex: 0 0 auto; scroll-snap-align: start; }
/* Centrades si hi caben; si no, es poden lliscar des de la primera */
.ig-highlights__list li:first-child { margin-left: auto; }
.ig-highlights__list li:last-child { margin-right: auto; }
.ig-highlight {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  width: 76px;
  text-decoration: none;
  color: var(--text);
}
.ig-highlight__ring {
  display: block;
  width: 70px;
  height: 70px;
  padding: 3px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pink), var(--blue));
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.ig-highlight__icon {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid #fff;
  background: linear-gradient(135deg, #fdf0f5, #eef0fb);
  font-size: 1.6rem;
  line-height: 1;
}
.ig-highlight__label {
  max-width: 100%;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ig-highlight:hover .ig-highlight__ring,
.ig-highlight:focus-visible .ig-highlight__ring { transform: scale(1.07); box-shadow: 0 10px 24px rgba(218, 26, 93, 0.25); }
.ig-highlight:focus-visible { outline: none; }
.ig-highlight:focus-visible .ig-highlight__ring { outline: 3px solid var(--blue); outline-offset: 3px; }

/* ── Publicacions ── */
.ig-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(4px, 1vw, 12px);
  margin-top: clamp(1.25rem, 3vw, 1.75rem);
}
.ig-post {
  position: relative;
  display: block;
  overflow: hidden;
  isolation: isolate;
  aspect-ratio: 1;
  border-radius: clamp(6px, 1.4vw, 16px);
  background: var(--bg-light);
  color: #fff;
  text-decoration: none;
}
.ig-post__media, .ig-post__media img { display: block; width: 100%; height: 100%; }
.ig-post__media img { object-fit: cover; transition: transform 0.6s cubic-bezier(.2, .8, .2, 1); }
.ig-post:hover .ig-post__media img,
.ig-post:focus-visible .ig-post__media img { transform: scale(1.06); }
.ig-post__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.3rem;
  padding: clamp(0.75rem, 2vw, 1.1rem);
  background: linear-gradient(180deg, rgba(20, 20, 60, 0) 35%, rgba(20, 20, 60, 0.82) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.ig-post:hover .ig-post__overlay,
.ig-post:focus-visible .ig-post__overlay { opacity: 1; }
.ig-post:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.ig-post__caption {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
}
.ig-post__date { font-size: 0.72rem; opacity: 0.85; }
.ig-post__more { font-size: 0.75rem; font-weight: 700; color: #ffd1e1; }
.ig-post__more::after { content: " →"; }
/* Icona del tipus de publicació (carrusel o vídeo), com a Instagram */
.ig-post[data-tipus="carrusel"]::after,
.ig-post[data-tipus="video"]::after {
  content: "";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.45));
  background: center / contain no-repeat;
}
.ig-post[data-tipus="carrusel"]::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M7 3h11a3 3 0 0 1 3 3v11a1 1 0 0 1-1 1h-1V6a1 1 0 0 0-1-1H6V4a1 1 0 0 1 1-1z'/%3E%3Crect x='3' y='7' width='13' height='14' rx='2.5'/%3E%3C/svg%3E");
}
.ig-post[data-tipus="video"]::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M8 5.5v13a1 1 0 0 0 1.5.9l10.5-6.5a1 1 0 0 0 0-1.8L9.5 4.6A1 1 0 0 0 8 5.5z'/%3E%3C/svg%3E");
}

.ig-more {
  display: block;
  width: fit-content;
  max-width: 100%;
  text-align: center;
  text-wrap: balance;
  margin: clamp(1.25rem, 3vw, 1.75rem) auto 0;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}
.ig-more:hover { text-decoration: underline; text-underline-offset: 4px; }
.ig-more:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 6px; }

/* ── Mòbil i tauleta ── */
@media (max-width: 860px) {
  .ig-profile { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
  .ig-qr { display: none; } /* al mòbil ja hi ets: el QR és per a l'ordinador */
}
@media (max-width: 560px) {
  .ig-card { border-radius: 24px; }
  /* Com a l'app: foto i nom a dalt, bio i botó a tota l'amplada */
  .ig-profile { grid-template-columns: 84px minmax(0, 1fr); gap: 0 1rem; align-items: center; }
  .ig-profile__info, .ig-profile__row { display: contents; }
  .ig-profile__avatar { grid-column: 1; grid-row: 1 / span 3; width: 84px; }
  .ig-profile__eyebrow { grid-column: 2; margin-bottom: 0.15rem; letter-spacing: 0.1em; font-size: 0.66rem; }
  .ig-profile__user { grid-column: 2; font-size: 1.25rem; }
  .ig-profile__stats { grid-column: 2; margin-top: 0.3rem; font-size: 0.85rem; gap: 0.1rem 0.9rem; }
  .ig-profile__name, .ig-profile__bio, .ig-profile__chips { grid-column: 1 / -1; }
  .ig-profile__name { margin-top: 0.9rem; }
  .ig-profile__follow { grid-column: 1 / -1; order: 1; margin-top: 1rem; justify-content: center; padding: 0.7rem 1rem; }
  .ig-highlights__list {
    gap: 0.75rem;
    /* s'esvaeix a la dreta: indica que se'n poden lliscar més */
    -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent);
    mask-image: linear-gradient(90deg, #000 82%, transparent);
  }
  .ig-highlight { width: 62px; }
  .ig-highlight__ring { width: 58px; height: 58px; }
  .ig-highlight__icon { font-size: 1.3rem; }
  .ig-highlight__label { font-size: 0.7rem; }
  .ig-post__overlay { display: none; } /* com a l'app: només la imatge */
  .ig-more { font-size: 0.82rem; }
}
/* Pantalles tàctils: el text del post no depèn del ratolí */
@media (hover: none) and (min-width: 561px) {
  .ig-post__overlay { opacity: 1; background: linear-gradient(180deg, rgba(20, 20, 60, 0) 55%, rgba(20, 20, 60, 0.78) 100%); }
  .ig-post__more { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ig-post__media img, .ig-post__overlay, .ig-highlight__ring { transition: none; }
  .ig-post:hover .ig-post__media img, .ig-post:focus-visible .ig-post__media img { transform: none; }
}

/* Biografia en línies, com a Instagram */
.ig-profile__cat { margin: 0 0 0.2rem; font-size: 0.82rem; color: var(--text-light); opacity: 0.85; }
ul.ig-profile__bio { list-style: none; padding: 0; display: grid; gap: 0.1rem; color: var(--text); }
ul.ig-profile__bio a { color: var(--primary); font-weight: 600; text-decoration: none; }
ul.ig-profile__bio a:hover, ul.ig-profile__bio a:focus-visible { text-decoration: underline; }
@media (max-width: 700px) { .ig-profile__cat { grid-column: 1 / -1; } }
/* Publicacions fixades: icona de xinxeta */
.ig-post[data-tipus="fixada"]::after {
  content: "";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 20px;
  height: 20px;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.35));
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M15.6 2.3a1 1 0 0 1 1.4 0l4.7 4.7a1 1 0 0 1 0 1.4l-1.3 1.3a1 1 0 0 1-1.1.2l-3.4 3.4.4 3.3a1 1 0 0 1-.3.8l-1.2 1.2a1 1 0 0 1-1.4 0L9.8 15l-5.1 5.1a1 1 0 0 1-1.4-1.4L8.4 13.6 4.8 10a1 1 0 0 1 0-1.4L6 7.4a1 1 0 0 1 .8-.3l3.3.4 3.4-3.4a1 1 0 0 1 .2-1.1z'/%3E%3C/svg%3E");
}

/* ─────────────────────────────────────────────
   PUBLICACIONS FIXADES: tríptic que es desplega
   Les 3 peces del logo arriben plegades com un acordió i s'obren
   quan la secció apareix; després una llum les recorre. Cada peça
   enllaça al seu post i s'aixeca en passar-hi el ratolí.
───────────────────────────────────────────── */
.ig-triptic { margin-top: clamp(1.25rem, 3vw, 1.75rem); }
.ig-triptic__tag {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin: 0 0 .8rem;
  padding: .35rem .85rem;
  border-radius: 999px;
  background: rgba(218, 26, 93, .1);
  color: #da1a5d;
  font-family: 'Montserrat', sans-serif;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.ig-triptic__tag svg { width: 14px; height: 14px; transform: rotate(35deg); }
.ig-triptic__panels {
  position: relative;
  display: flex;
  perspective: 1600px;
  border-radius: 22px;
  filter: drop-shadow(0 24px 40px rgba(218, 26, 93, .28));
}
.ig-triptic__panel {
  --fold: 0deg;
  position: relative;
  flex: 1 1 0;
  aspect-ratio: 1;
  display: block;
  overflow: hidden;
  background: #d23a6e;
  transform-style: preserve-3d;
  transform: rotateY(var(--fold)) translateZ(var(--z, 0px));
  transition: transform .9s cubic-bezier(.2, .8, .2, 1), filter .35s ease;
  transition-delay: calc(var(--i) * 90ms);
}
.ig-triptic__panel:first-child { border-radius: 22px 0 0 22px; transform-origin: right center; }
.ig-triptic__panel:nth-child(2) { transform-origin: center; margin-left: -1px; }
.ig-triptic__panel:nth-child(3) { border-radius: 0 22px 22px 0; transform-origin: left center; margin-left: -1px; }
.ig-triptic__panel img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* ombra del plec */
.ig-triptic__panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(40, 0, 30, var(--sl, 0)), transparent 45%, transparent 55%, rgba(40, 0, 30, var(--sr, 0)));
  transition: opacity .9s ease;
}
.ig-triptic__veure {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  z-index: 2;
  padding: .5rem 1rem;
  border-radius: 999px;
  background: #fff;
  color: #da1a5d;
  font-family: 'Montserrat', sans-serif;
  font-size: .75rem;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(60, 0, 30, .3);
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity .3s ease, transform .3s ease;
}
.ig-triptic__panel:hover,
.ig-triptic__panel:focus-visible { --z: 40px; filter: brightness(1.06); z-index: 1; }
.ig-triptic__panel:hover .ig-triptic__veure,
.ig-triptic__panel:focus-visible .ig-triptic__veure { opacity: 1; transform: translate(-50%, 0); }
.ig-triptic__panel:focus-visible { outline: 3px solid #2f2f96; outline-offset: 3px; }
.ig-triptic__brillo {
  position: absolute;
  inset: 0;
  border-radius: 22px;
  overflow: hidden;
  pointer-events: none;
}
.ig-triptic__brillo::before {
  content: "";
  position: absolute;
  top: -20%; bottom: -20%;
  left: -40%;
  width: 28%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .45), transparent);
  transform: skewX(-18deg);
  opacity: 0;
}

/* Plegat (abans d'aparèixer) */
@media (prefers-reduced-motion: no-preference) {
  .ig-triptic.is-wait .ig-triptic__panel:first-child { --fold: 62deg; --sr: .45; }
  .ig-triptic.is-wait .ig-triptic__panel:nth-child(2) { --z: -120px; --sl: .25; --sr: .25; }
  .ig-triptic.is-wait .ig-triptic__panel:nth-child(3) { --fold: -62deg; --sl: .45; }
  .ig-triptic.is-wait .ig-triptic__panels { opacity: .0; transform: scale(.9); }
  .ig-triptic__panels { transition: opacity .6s ease, transform .9s cubic-bezier(.2, .8, .2, 1); }
  .ig-triptic.is-in .ig-triptic__brillo::before { animation: igBrillo 1.4s 1.1s ease-in-out both; }
  .ig-triptic.is-in .ig-triptic__tag svg { animation: igPin .7s 1s cubic-bezier(.34, 1.56, .64, 1) both; }
}
@keyframes igBrillo {
  0% { left: -40%; opacity: 0; }
  15% { opacity: 1; }
  100% { left: 120%; opacity: 0; }
}
@keyframes igPin {
  0% { transform: rotate(35deg) translateY(-8px) scale(.6); opacity: 0; }
  100% { transform: rotate(35deg); opacity: 1; }
}
.ig-triptic + .ig-grid { margin-top: clamp(10px, 2vw, 18px); }

@media (max-width: 600px) {
  .ig-triptic__panels { border-radius: 16px; }
  .ig-triptic__panel:first-child { border-radius: 16px 0 0 16px; }
  .ig-triptic__panel:nth-child(3) { border-radius: 0 16px 16px 0; }
  .ig-triptic__veure { display: none; }
}

/* Tríptic més compacte i centrat */
.ig-triptic { display: flex; flex-direction: column; align-items: center; }
.ig-triptic__panels { width: 100%; max-width: 540px; }
.ig-triptic__veure { font-size: .68rem; padding: .4rem .8rem; bottom: .7rem; }
@media (max-width: 600px) { .ig-triptic__panels { max-width: 420px; } }
