/* ===========================================================
   DESTAQUES (estilo Instagram) — faixa de círculos no ecrã
   principal com as últimas publicações da Comunidade e Notícias.
   =========================================================== */
.destaques-hub {
  display: flex;
  gap: 22px;
  padding: 6px 4px 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.destaques-hub::-webkit-scrollbar { display: none; }
.destaques-hub:empty { display: none; }

.destaque-btn {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font: inherit;
  color: var(--beige, #f3e9ff);
  -webkit-tap-highlight-color: transparent;
}
.destaque-anel {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  padding: 3px;
  background: rgba(200, 190, 215, .45);
  transition: transform .15s ease;
}
.destaque-btn.tem-novo .destaque-anel {
  background: conic-gradient(from 200deg, #d4af37, #f5d77a, #b57be0, #7b3fb8, #d4af37);
  animation: destaque-brilho 2.8s ease-in-out infinite;
}
@keyframes destaque-brilho {
  0%, 100% { box-shadow: 0 0 0 rgba(212, 175, 55, 0); }
  50% { box-shadow: 0 0 14px rgba(212, 175, 55, .55); }
}
.destaque-btn:active .destaque-anel { transform: scale(.94); }
.destaque-miniatura {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid var(--violet-deep, #1a0b2e);
  background: #2a1450 center / cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  overflow: hidden;
}
.destaque-nome {
  font-size: .74rem;
  letter-spacing: .02em;
  max-width: 78px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
html[data-tema="claro"] .destaque-miniatura { border-color: #fdf8f0; background-color: #efe3f7; }
html[data-tema="claro"] .destaque-btn { color: #4a2c5e; }

/* ---------- Visualizador em ecrã inteiro ---------- */
.story-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(8, 3, 20, .96);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: story-entrar .22s ease;
  touch-action: pan-y;
}
@keyframes story-entrar { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
.story-caixa {
  position: relative;
  width: 100%;
  max-width: 460px;
  height: 100%;
  max-height: 820px;
  display: flex;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px calc(env(safe-area-inset-bottom, 0px) + 18px);
  color: #f3e9ff;
}
.story-barras { display: flex; gap: 4px; }
.story-barra { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .25); overflow: hidden; }
.story-barra > i { display: block; height: 100%; width: 0; background: #f5d77a; }
.story-barra.vista > i { width: 100%; }
.story-barra.ativa > i { animation: story-progresso var(--story-ms, 6000ms) linear forwards; }
.story-overlay.pausado .story-barra.ativa > i { animation-play-state: paused; }
@keyframes story-progresso { to { width: 100%; } }

.story-topo { display: flex; align-items: center; gap: 10px; margin: 12px 0 10px; position: relative; z-index: 3; }
/* nomes compridos (ex.: "Lua Minguante em Leão") não podem espremer os botões redondos */
.story-topo > div { flex: 1 1 auto; min-width: 0; }
.story-topo > button { flex: 0 0 auto; }
.story-avatar { width: 34px; height: 34px; border-radius: 50%; background: #2a1450 center / cover; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; }
.story-autor { font-weight: 600; font-size: .9rem; line-height: 1.2; }
.story-data { font-size: .74rem; opacity: .7; }
.story-fechar { margin-left: auto; background: none; border: 0; color: #fff; font-size: 1.7rem; line-height: 1; cursor: pointer; padding: 4px 8px; }

.story-corpo { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; min-height: 0; }
.story-imagem { width: 100%; max-height: 52vh; object-fit: contain; border-radius: 14px; }
.story-titulo { font-family: 'Cinzel', serif; color: #f5d77a; font-size: 1.25rem; margin: 0; }
.story-texto { margin: 0; line-height: 1.55; font-size: .98rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; }
.story-vazio { text-align: center; opacity: .8; }

.story-acoes { display: flex; justify-content: center; padding-top: 12px; }
.story-ler {
  background: linear-gradient(135deg, #d4af37, #b8860b);
  color: #1a0b2e;
  border: 0;
  border-radius: 999px;
  padding: 11px 28px;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  z-index: 2;
}
/* zonas invisíveis de toque: esquerda = anterior, direita = seguinte */
/* começam por baixo do topo (no iPhone com notch o topo desce com a safe-area) — o ✕ nunca fica tapado */
.story-zona { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 84px); bottom: 80px; width: 35%; z-index: 1; }
.story-zona.esq { left: 0; }
.story-zona.dir { right: 0; }

/* ---------- Gostos ---------- */
.story-gostos-nomes { font-size: .8rem; opacity: .8; text-align: center; min-height: 1.2em; margin-top: 10px; }
.story-acoes { gap: 12px; align-items: center; }
.story-gosto {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 64px;
  justify-content: center;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .25);
  color: #fff;
  border-radius: 999px;
  padding: 9px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.story-gosto .coracao { font-size: 1.25rem; line-height: 1; }
.story-gosto.gostei { border-color: rgba(255, 110, 150, .6); background: rgba(255, 90, 140, .18); }
.story-gosto.gostei .coracao { color: #ff5c8a; animation: gosto-pop .35s ease; }
.story-gosto.a-pulsar { opacity: .75; }
.story-gosto[hidden] { display: none; }
@keyframes gosto-pop { 0% { transform: scale(.6); } 60% { transform: scale(1.3); } 100% { transform: scale(1); } }

/* ---------- 1.º destaque: signo do utilizador → Perfil Energético ---------- */
.destaque-signo .destaque-anel {
  background: linear-gradient(135deg, #f5d77a, #d4af37 40%, #9b6bd3);
}
.destaque-signo .destaque-miniatura {
  background: radial-gradient(circle at 50% 40%, #3b1d6e, #1a0b2e);
}
.destaque-signo .destaque-miniatura img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  transform: scale(1.12);      /* a imagem tem margem própria — assim preenche a bolinha */
}
html[data-tema="claro"] .destaque-signo .destaque-miniatura {
  background: radial-gradient(circle at 50% 40%, #fff7e3, #efe3f7);
}

/* ---------- Visualizador: roxo no tema escuro, bege no tema claro ---------- */
.story-overlay {
  background:
    radial-gradient(circle at 50% 0%, rgba(150, 120, 196, .35), transparent 60%),
    linear-gradient(180deg, #2a1450 0%, #150a2e 100%);
}
html[data-tema="claro"] .story-overlay {
  background:
    radial-gradient(circle at 50% 0%, rgba(233, 196, 106, .25), transparent 60%),
    linear-gradient(180deg, #fdf8ef 0%, #f3e9d8 100%);
}
html[data-tema="claro"] .story-caixa { color: #3b2a4a; }
html[data-tema="claro"] .story-barra { background: rgba(74, 47, 112, .15); }
html[data-tema="claro"] .story-barra > i { background: #b8862b; }
html[data-tema="claro"] .story-fechar { color: #4a2f70; }
html[data-tema="claro"] .story-avatar { background-color: #efe3f7; }
html[data-tema="claro"] .story-titulo { color: #8a5f14; }
html[data-tema="claro"] .story-data,
html[data-tema="claro"] .story-gostos-nomes { color: #6d5a7d; opacity: 1; }
html[data-tema="claro"] .story-vazio { color: #6d5a7d; }
html[data-tema="claro"] .story-gosto { background: rgba(74, 47, 112, .06); border-color: rgba(168, 121, 31, .4); color: #4a2f70; }
html[data-tema="claro"] .story-gosto.gostei { background: rgba(255, 90, 140, .12); border-color: rgba(224, 70, 120, .5); }
html[data-tema="claro"] .story-imagem { box-shadow: 0 8px 24px rgba(74, 47, 112, .18); }

/* barrinhas de progresso tocáveis (área de toque maior que a barra) */
.story-barras { padding: 10px 0; margin: -10px 0 -6px; cursor: pointer; position: relative; z-index: 3; }
.story-barra { height: 4px; }

/* ---------- narração nos destaques ---------- */
.story-narrar {
  margin-left: auto;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .28);
  color: #fff;
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  position: relative; z-index: 3;
}
.story-narrar + .story-fechar { margin-left: 4px; }
.story-narrar.ativo { background: linear-gradient(135deg, #f3d98b, #d4af37); border-color: transparent; animation: narrar-pulso 1.4s ease-in-out infinite; }
@keyframes narrar-pulso { 0%, 100% { box-shadow: 0 0 0 0 rgba(212, 175, 55, .5); } 50% { box-shadow: 0 0 0 7px rgba(212, 175, 55, 0); } }
/* com narração a barra da publicação atual "respira" em vez de contar 6 s */
.story-overlay.a-ler .story-barra.ativa > i { animation: barra-narrar 1.6s ease-in-out infinite; width: 100%; }
/* vídeo: a barra segue o tempo do vídeo (largura posta pelo destaques.js) */
.story-barra.ativa.video > i, .story-overlay.a-ler .story-barra.ativa.video > i { animation: none; transition: width .25s linear; }
@keyframes barra-narrar { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
html[data-tema="claro"] .story-narrar { background: rgba(74, 47, 112, .06); border-color: rgba(168, 121, 31, .4); color: #4a2f70; }

/* ---------- carrossel de fotos por publicação (Comunidade) ---------- */
.story-foto { position: relative; display: flex; justify-content: center; }
.story-foto-num {
  position: absolute; top: 8px; right: 8px;
  background: rgba(20, 10, 40, .6); color: #fff;
  font-size: .72rem; font-weight: 600; letter-spacing: .03em;
  padding: 3px 9px; border-radius: 999px; pointer-events: none;
}
.story-foto-mais {
  position: absolute; bottom: 10px; right: 10px; z-index: 3;
  background: rgba(20, 10, 40, .72); color: #f5d77a;
  border: 1px solid rgba(245, 215, 122, .6); border-radius: 999px;
  padding: 6px 14px; font-size: .85rem; font-weight: 600; cursor: pointer;
}
html[data-tema="claro"] .story-foto-num { background: rgba(255, 255, 255, .85); color: #4a2f70; }
html[data-tema="claro"] .story-foto-mais { background: rgba(255, 255, 255, .92); color: #8a5f14; border-color: rgba(168, 121, 31, .5); }

/* ---------- música de fundo ---------- */
.story-musica {
  margin-left: auto;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .28);
  color: #fff;
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  position: relative; z-index: 3;
}
.story-musica + .story-narrar { margin-left: 0; }
.story-info {
  margin-left: auto;
  width: 30px; height: 30px; border-radius: 50%;
  background: transparent; border: 1px solid rgba(245, 215, 122, .6);
  color: #f5d77a; font-family: Georgia, serif; font-style: italic; font-weight: 700; font-size: .95rem;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  position: relative; z-index: 3;
}
.story-info + .story-musica { margin-left: 0; }
html[data-tema="claro"] .story-info { color: #8a5f14; border-color: rgba(168, 121, 31, .5); }
.story-musica.ativo { border-color: rgba(245, 215, 122, .7); background: rgba(245, 215, 122, .18); }
.story-musica.desligada { opacity: .55; text-decoration: line-through; }
html[data-tema="claro"] .story-musica { background: rgba(74, 47, 112, .06); border-color: rgba(168, 121, 31, .4); color: #4a2f70; }
html[data-tema="claro"] .story-musica.ativo { background: rgba(233, 196, 106, .22); }

/* ---------- Notícias: contador no círculo e "Saber mais" ---------- */
.destaque-anel { position: relative; }
.destaque-contador {
  position: absolute; top: -2px; right: -2px;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px;
  background: #e0245e; color: #fff;
  font-size: .72rem; font-weight: 700; line-height: 20px; text-align: center;
  border: 2px solid var(--fundo, #1a0b2e);
  box-sizing: border-box;
}
html[data-tema="claro"] .destaque-contador { border-color: #fdf8ef; }
.story-ler[hidden] { display: none; }
.story-info[hidden] { display: none; }
.story-info[hidden] + .story-musica { margin-left: auto; }

/* ---------- 4 círculos (Energia + Montra + Comunidade + Notícias) ----------
   Com 4 destaques o espaço entre eles encolhe para caberem todos no ecrã do
   telemóvel; em ecrãs muito estreitos os círculos também ficam um pouco menores. */
.destaques-hub:has(> .destaque-btn:nth-child(4)) {
  gap: clamp(8px, calc((100vw - 330px) / 3), 22px);
  justify-content: space-between;
  padding-left: 2px;
  padding-right: 2px;
}
@media (max-width: 360px) {
  .destaques-hub:has(> .destaque-btn:nth-child(4)) .destaque-anel { width: 64px; height: 64px; }
}

/* Texto longo em qualquer destaque: lê-se tudo com scroll (em vez de cortar às 7 linhas) */
.story-texto {
  display: block; -webkit-line-clamp: unset; white-space: pre-line;
  overflow-y: auto; max-height: 34vh; padding-right: 4px;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
/* com scroll, o texto fica por cima das zonas de toque (para se poder deslizar) */
.story-texto.rola { position: relative; z-index: 2; touch-action: pan-y; }
/* A fotografia tem sempre o mesmo tamanho (metade do ecrã), com ou sem texto;
   o texto longo desliza no espaço que sobra por baixo. */
.story-imagem { max-height: 50vh; flex: 0 0 auto; }
.story-titulo { flex: 0 0 auto; }
.story-texto { flex: 0 1 auto; min-height: 3.1em; max-height: none; }

/* Comunidade: botão secundário "Comunidade" ao lado do "Aceder" */
.story-ir-comunidade {
  background: transparent; color: #f5d77a; border: 1px solid rgba(245, 215, 122, .6);
  border-radius: 999px; padding: 10px 22px; font-weight: 700; cursor: pointer; position: relative; z-index: 2;
}
.story-ir-comunidade[hidden] { display: none; }
html[data-tema="claro"] .story-ir-comunidade { color: #8a6412; border-color: rgba(168, 121, 31, .55); }

/* 🎬 vídeos da comunidade nos destaques */
.story-video { background: #000; }
.story-video-som { position: absolute; right: 8px; bottom: 8px; z-index: 4; width: 38px; height: 38px; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 1.05rem; cursor: pointer; }
