/* ==========================================================================
   JUNTOS — Seção 06: "Um pouco das nossas conversas" (Fan Card Carousel)
   Identidade visual: Verde-oliva escuro (#363a2d), Terracota (#9e5b43 / #b9775d),
   Off-white (#f6f2e9), Areia (#d8c9b4), Nunito Editorial + Montserrat
   ========================================================================== */

.reels-section,
.reel-modal-backdrop {
  --reels-bg: #363a2d;
  --reels-bg-deep: #2a2d22;
  --reels-ink: #f6f2e9;
  --reels-muted: #f6f2e9c9;
  --reels-clay: #e9bea7;
  --reels-terracotta: #9e5b43;
  --reels-hairline: rgba(216, 201, 180, .22);
  --reels-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --reels-fast: cubic-bezier(0.16, 1, 0.3, 1);
}

.reels-section {
  position: relative;
  z-index: 8;
  background-color: var(--reels-bg);
  /* Textura orgânica extremamente sutil coerente com o sistema visual JUNTOS */
  background-image:
    radial-gradient(ellipse at 50% 18%, rgba(216, 201, 180, .09), transparent 54%),
    radial-gradient(ellipse at 16% 78%, rgba(185, 119, 93, .11), transparent 50%),
    radial-gradient(ellipse at 86% 72%, rgba(246, 242, 233, .045), transparent 50%),
    repeating-linear-gradient(
      125deg,
      rgba(246, 242, 233, .012) 0px,
      rgba(246, 242, 233, .012) 1px,
      transparent 1px,
      transparent 10px
    ),
    repeating-linear-gradient(
      35deg,
      rgba(20, 23, 16, .028) 0px,
      rgba(20, 23, 16, .028) 1px,
      transparent 1px,
      transparent 12px
    );
  color: var(--reels-ink);
  overflow-x: clip;
}

/* Transição orgânica suave do off-white da Seção 05 para o verde-oliva escuro */
.reels-bridge-top {
  display: block;
  width: 100%;
  height: clamp(32px, 4.6vw, 66px);
  background: var(--paper);
  line-height: 0;
  margin-top: -1px;
}

.reels-bridge-top svg {
  display: block;
  width: 100%;
  height: 100%;
}

.reels-bridge-top path {
  fill: var(--reels-bg);
}

.reels-inner {
  padding: clamp(54px, 7.6svh, 96px) 0 clamp(68px, 9.2svh, 112px);
}

/* ==========================================================================
   CABEÇALHO CENTRALIZADO + PERFIL DO INSTAGRAM (@psicologanaluiza)
   ========================================================================== */

.reels-header {
  width: var(--cares-container);
  margin: 0 auto clamp(34px, 5svh, 52px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.reels-title {
  margin: 0;
  font-size: clamp(34px, 3.85vw, 54px);
  font-weight: 500;
  line-height: 1.06;
  letter-spacing: -.042em;
  color: var(--reels-ink);
  text-wrap: balance;
}

.reels-title-line {
  display: block;
}

.reels-title-accent {
  position: relative;
  display: inline-block;
  font-family: var(--cares-display);
  font-style: normal;
  font-weight: 650;
  letter-spacing: -.028em;
  color: var(--reels-clay);
}

.reels-title-stroke {
  position: absolute;
  left: -2%;
  right: -2%;
  bottom: -.12em;
  width: 104%;
  height: .22em;
  pointer-events: none;
  overflow: visible;
}

.reels-title-stroke path {
  fill: none;
  stroke: var(--transformation);
  stroke-width: 2.1;
  stroke-linecap: round;
  opacity: .84;
}

/* Identificação compacta e elegante do Instagram */
.reels-profile-link {
  margin-top: clamp(18px, 2.5svh, 24px);
  min-height: 46px;
  padding: 6px 16px 6px 7px;
  border-radius: 999px;
  border: 1px solid rgba(216, 201, 180, .30);
  background: rgba(246, 242, 233, .075);
  color: var(--reels-ink);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  letter-spacing: -.012em;
  white-space: nowrap;
  transition:
    background-color 200ms var(--reels-fast),
    border-color 200ms var(--reels-fast),
    transform 200ms var(--reels-fast);
}

.reels-profile-link:hover {
  background: rgba(246, 242, 233, .145);
  border-color: rgba(233, 190, 167, .62);
  transform: translate3d(0, -1.5px, 0);
}

.reels-profile-link:focus-visible {
  outline: 2px solid var(--reels-ink);
  outline-offset: 4px;
}

.reels-profile-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  border: 1.5px solid rgba(233, 190, 167, .75);
  flex: none;
}

.reels-profile-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: 50% 22%;
}

.reels-profile-handle {
  font-weight: 500;
}

.reels-profile-ig {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--reels-clay);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 200ms var(--reels-fast);
}

.reels-profile-link:hover .reels-profile-ig {
  transform: scale(1.08);
}

.reels-profile-ig svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ==========================================================================
   FAN CARD CAROUSEL (.fan-layout & .fan-card — Proporção Vertical 9:16)
   ========================================================================== */

.reels-carousel-shell {
  position: relative;
  width: min(calc(100% - clamp(12px, 3vw, 56px)), 1400px);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fan-layout {
  position: relative;
  width: 100%;
  height: clamp(440px, 58svh, 540px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}

.fan-layout:focus-visible {
  outline: 2px solid var(--reels-ink);
  outline-offset: 6px;
  border-radius: 22px;
}

.fan-layout.is-dragging {
  cursor: grabbing;
}

/* Cards em Leque — Proporção 9:16 real dos Reels */
.fan-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(212px, 18.2vw, 252px);
  aspect-ratio: 9 / 16;
  margin-left: calc(clamp(212px, 18.2vw, 252px) * -.5);
  margin-top: calc(clamp(212px, 18.2vw, 252px) * -.8889);
  border-radius: 20px;
  overflow: hidden;
  background: var(--reels-bg-deep);
  border: 1px solid rgba(246, 242, 233, .16);
  box-shadow:
    0 24px 48px -22px rgba(15, 17, 12, .62),
    0 8px 18px -10px rgba(15, 17, 12, .40);
  transform-origin: center 82%;
  will-change: transform, opacity;
  cursor: pointer;
}

.fan-card.is-center {
  border-color: rgba(233, 190, 167, .52);
  box-shadow:
    0 34px 66px -22px rgba(12, 14, 10, .74),
    0 12px 24px -12px rgba(12, 14, 10, .48);
}

.fan-card.is-hidden-slot {
  pointer-events: none;
}

.fan-card-media {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--reels-bg-deep);
}

.fan-card-cover {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  pointer-events: none;
}

/* Gradiente suave editorial preservando nitidez do rosto */
.fan-card-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(28, 31, 23, .08) 0%,
    rgba(28, 31, 23, .04) 46%,
    rgba(24, 27, 20, .62) 100%
  );
  pointer-events: none;
  transition: opacity 240ms var(--reels-fast);
}

.fan-card.is-playing .fan-card-scrim {
  opacity: 0;
}

/* Botão Circular de Reprodução (apenas no card central) */
.fan-play-btn {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  width: 60px;
  height: 60px;
  padding: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(246, 242, 233, .72);
  background: rgba(54, 58, 45, .64);
  backdrop-filter: blur(8px);
  color: var(--reels-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%) scale(.88);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 240ms var(--reels-fast),
    transform 260ms var(--reels-ease),
    background-color 180ms var(--reels-fast),
    border-color 180ms var(--reels-fast);
}

.fan-card.is-center:not(.is-playing) .fan-play-btn {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.fan-card.is-center:not(.is-playing) .fan-play-btn:hover {
  background: var(--reels-terracotta);
  border-color: rgba(246, 242, 233, .92);
  transform: translate(-50%, -50%) scale(1.07);
}

.fan-play-btn:focus-visible {
  outline: 2px solid var(--reels-ink);
  outline-offset: 4px;
}

.fan-play-btn svg {
  width: 21px;
  height: 21px;
  margin-left: 2px;
  fill: currentColor;
}

/* Player de Vídeo Interno Sob Demanda (quando videoUrl está disponível) */
.fan-video-slot {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: #1a1c15;
}

.fan-video-slot[hidden] {
  display: none;
}

.fan-video-el {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.fan-video-controls {
  position: absolute;
  inset: auto 0 0;
  z-index: 6;
  padding: 28px 12px 12px;
  background: linear-gradient(180deg, transparent 0%, rgba(20, 23, 16, .84) 100%);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fan-video-bar {
  width: 100%;
  height: 3px;
  border-radius: 99px;
  background: rgba(246, 242, 233, .28);
  overflow: hidden;
}

.fan-video-bar-fill {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--reels-clay);
  transform: scaleX(var(--video-progress, 0));
  transform-origin: left center;
}

.fan-video-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.fan-ctrl-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(246, 242, 233, .36);
  background: rgba(34, 37, 28, .72);
  color: var(--reels-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 160ms var(--reels-fast);
}

.fan-ctrl-btn:hover {
  background: var(--reels-terracotta);
}

.fan-ctrl-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Setas Laterais do Leque */
.fan-nav-btn {
  position: absolute;
  top: 50%;
  z-index: 48;
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(216, 201, 180, .34);
  background: rgba(54, 58, 45, .82);
  backdrop-filter: blur(8px);
  color: var(--reels-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-50%);
  transition:
    background-color 170ms var(--reels-fast),
    border-color 170ms var(--reels-fast),
    color 170ms var(--reels-fast),
    transform 170ms var(--reels-fast);
}

.fan-nav-btn--prev { left: clamp(4px, 1.5vw, 22px); }
.fan-nav-btn--next { right: clamp(4px, 1.5vw, 22px); }

.fan-nav-btn svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fan-nav-btn:hover {
  background: var(--reels-ink);
  border-color: var(--reels-ink);
  color: var(--reels-bg-deep);
}

.fan-nav-btn:active {
  transform: translateY(-50%) scale(.95);
}

.fan-nav-btn:focus-visible {
  outline: 2px solid var(--reels-ink);
  outline-offset: 4px;
}

/* ==========================================================================
   TÍTULO DINÂMICO ABAIXO DO CARROSSEL (Altura Reservada — Zero Salto)
   ========================================================================== */

.reels-caption-wrap {
  width: var(--cares-container);
  max-width: 620px;
  min-height: 76px;
  margin: clamp(24px, 3.6svh, 36px) auto 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.reels-caption-inner {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  transition:
    opacity 240ms var(--reels-fast),
    transform 300ms var(--reels-ease);
}

.reels-caption-inner.is-swapping {
  opacity: 0;
  transform: translate3d(0, 9px, 0);
}

.reels-dynamic-title {
  margin: 0;
  font-size: clamp(17px, 1.45vw, 21px);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -.018em;
  color: var(--reels-ink);
  text-wrap: balance;
}

.reels-counter {
  margin: 0;
  font-size: 12.5px;
  letter-spacing: .08em;
  color: var(--reels-clay);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   MODAL ELEGANTE DE REEL (Embed Oficial do Instagram ou Acesso Direto)
   ========================================================================== */

.reel-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 95;
  padding: 20px;
  background: rgba(24, 27, 20, .82);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 240ms var(--reels-fast),
    visibility 0s linear 240ms;
}

.reel-modal-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  transition:
    opacity 260ms var(--reels-ease),
    visibility 0s linear 0s;
}

.reel-modal-dialog {
  position: relative;
  width: min(100%, 400px);
  border-radius: 22px;
  background: #363a2d;
  border: 1px solid rgba(216, 201, 180, .32);
  box-shadow: 0 36px 80px -24px rgba(10, 12, 8, .75);
  overflow: hidden;
  color: var(--reels-ink);
  transform: translate3d(0, 14px, 0) scale(.97);
  transition: transform 300ms var(--reels-ease);
}

.reel-modal-backdrop.is-open .reel-modal-dialog {
  transform: translate3d(0, 0, 0) scale(1);
}

.reel-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(246, 242, 233, .40);
  background: rgba(34, 37, 28, .78);
  color: var(--reels-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 160ms var(--reels-fast);
}

.reel-modal-close:hover {
  background: var(--reels-terracotta);
}

.reel-modal-close svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.reel-modal-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 12.2;
  background: var(--reels-bg-deep);
  overflow: hidden;
}

.reel-modal-stage img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.reel-modal-stage iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: var(--reels-bg-deep);
}

.reel-modal-body {
  padding: 20px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.reel-modal-kicker {
  margin: 0;
  font-size: 12.5px;
  color: var(--reels-clay);
}

.reel-modal-title {
  margin: 0;
  font-family: var(--cares-display);
  font-size: 20px;
  font-weight: 650;
  line-height: 1.24;
  color: var(--reels-ink);
}

.reel-modal-note {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.52;
  color: var(--reels-muted);
}

.reel-modal-cta {
  margin-top: 6px;
  min-height: 46px;
  padding: 12px 20px;
  border-radius: 10px;
  background: var(--reels-ink);
  color: #2f3326;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 170ms var(--reels-fast);
}

.reel-modal-cta:hover {
  background: var(--welcome);
}

/* ==========================================================================
   RESPONSIVIDADE — TABLET E MOBILE (Leque Preservado + Zero Overflow)
   ========================================================================== */

@media (max-width: 1080px) {
  .fan-layout {
    height: clamp(410px, 54svh, 490px);
  }

  .fan-card {
    width: clamp(194px, 24vw, 232px);
    margin-left: calc(clamp(194px, 24vw, 232px) * -.5);
    margin-top: calc(clamp(194px, 24vw, 232px) * -.8889);
  }
}

@media (max-width: 700px) {
  .reels-carousel-shell {
    width: 100%;
  }

  .fan-layout {
    height: clamp(395px, 56svh, 456px);
  }

  .fan-card {
    width: clamp(192px, 53vw, 224px);
    margin-left: calc(clamp(192px, 53vw, 224px) * -.5);
    margin-top: calc(clamp(192px, 53vw, 224px) * -.8889);
    border-radius: 18px;
  }

  .fan-nav-btn {
    width: 44px;
    height: 44px;
  }

  .fan-nav-btn--prev { left: 10px; }
  .fan-nav-btn--next { right: 10px; }

  .reels-caption-wrap {
    min-height: 82px;
    padding-inline: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reels-caption-inner,
  .fan-play-btn,
  .reel-modal-backdrop,
  .reel-modal-dialog,
  .reels-profile-link {
    transition: none !important;
  }
}
