/* ==================================================================
   Reels — feed vertical em tela cheia (alpha.84)
   - Celular: sem cabeçalho e sem abas no topo; só o vídeo e a barra de baixo do site.
   - Computador: o cabeçalho continua e o feed vira um "quadro" 9:16 centralizado.
   - Trocar de aba / abrir o estúdio ficam na folha "Mais opções" (botão ⋯).
   Cores do site só por variáveis do tema; sobre o vídeo o texto é sempre branco.
   Carregado por pages/social/reels_index.php, depois de social.css.
   ================================================================== */

.reels-page { --reel-bar: calc(var(--bottom-nav-height, 0px) + env(safe-area-inset-bottom, 0px)); padding: 0; }

/* ------------------------------ quadro (stage) ------------------------------ */
.reels-stage {
  --reel-h: calc(100vh - var(--header-height, 64px) - 28px);
  position: relative;
  width: min(100%, 460px, calc(var(--reel-h) * .5625));
  min-width: min(100%, 320px);
  height: var(--reel-h);
  margin: 14px auto 0;
  overflow: hidden;
  border-radius: 26px;
  background: #000;
  color: #fff;
  box-shadow: 0 30px 70px -28px rgba(0, 0, 0, .75), 0 0 0 1px rgba(255, 255, 255, .06);
  isolation: isolate;
}
@supports (height: 100dvh) {
  .reels-stage { --reel-h: calc(100dvh - var(--header-height, 64px) - 28px); }
}

.reels-feed {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: #000;
}
.reels-feed::-webkit-scrollbar { display: none; }

/* ------------------------------ cartão do reel ------------------------------ */
.reel {
  position: relative;
  height: 100%;
  overflow: hidden;
  background: #000;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.reel:focus-visible { box-shadow: inset 0 0 0 3px var(--accent); }
.reel video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
/* vídeo horizontal: mostra inteiro, sem cortar as laterais */
.reel.is-wide video { object-fit: contain; }

.reel-scrim {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(0deg, rgba(0, 0, 0, .82) 0, rgba(0, 0, 0, .38) 30%, transparent 56%),
    linear-gradient(180deg, rgba(0, 0, 0, .34) 0, transparent 20%);
}

/* botão central de reproduzir (aparece quando o reel está pausado) */
.reel-play {
  position: absolute; left: 50%; top: 50%; z-index: 3;
  width: 72px; height: 72px; margin: -36px 0 0 -36px; padding: 0;
  display: none; place-items: center;
  border: 1px solid rgba(255, 255, 255, .22); border-radius: 50%;
  background: rgba(16, 14, 26, .5); color: #fff; cursor: pointer;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  animation: reel-pop .22s ease-out;
}
.reel-play .icon { width: 30px; height: 30px; fill: currentColor; margin-left: 3px; }
.reel.is-paused .reel-play { display: grid; }
@keyframes reel-pop { from { transform: scale(.7); opacity: 0; } to { transform: none; opacity: 1; } }

/* ------------------------------ informações ------------------------------ */
.reel-info {
  position: absolute; z-index: 2; left: 14px; right: 74px; bottom: 20px;
  display: grid; justify-items: start; gap: 8px;
  text-shadow: 0 1px 10px rgba(0, 0, 0, .5);
}
.reel-creator { display: flex; align-items: center; gap: 10px; max-width: 100%; min-width: 0; }
.reel-avatar {
  flex: none; width: 40px; height: 40px; display: grid; place-items: center; overflow: hidden;
  border: 2px solid rgba(255, 255, 255, .9); border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #ec4899);
  color: #fff; font-weight: 800; text-decoration: none; text-shadow: none;
}
.reel-avatar img { width: 100%; height: 100%; object-fit: cover; }
.reel-handle { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; font-weight: 800; font-size: 1rem; text-decoration: none; }
.reel-follow {
  flex: none; padding: 5px 13px; border: 1.5px solid rgba(255, 255, 255, .85); border-radius: 999px;
  background: transparent; color: #fff; font: inherit; font-size: .78rem; font-weight: 800; cursor: pointer; text-shadow: none;
  transition: background .15s, border-color .15s, transform .12s;
}
.reel-follow:active { transform: scale(.94); }
.reel-follow[aria-pressed="true"] { border-color: transparent; background: rgba(255, 255, 255, .2); }
.reel-title {
  margin: 0; color: #fff; font-size: 1.02rem; font-weight: 800; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.reel-desc {
  margin: 0; max-width: 100%; color: rgba(255, 255, 255, .9); font-size: .88rem; line-height: 1.4; cursor: pointer;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.reel-desc.is-open { display: block; max-height: 34vh; overflow-y: auto; }
.reel .reel-tags { margin: 0; display: flex; flex-wrap: wrap; gap: 2px 8px; }
.reel .reel-tags a { color: #fff; font-size: .86rem; font-weight: 700; text-decoration: none; opacity: .95; }
.reel .reel-tags a:hover { text-decoration: underline; }

/* ------------------------------ coluna de ações ------------------------------ */
.reel-rail {
  position: absolute; z-index: 3; right: 10px; bottom: 18px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.reel-act { display: grid; justify-items: center; gap: 3px; }
.reel-btn {
  width: 46px; height: 46px; padding: 0; display: grid; place-items: center;
  border: 1px solid rgba(255, 255, 255, .14); border-radius: 50%;
  background: rgba(16, 14, 26, .42); color: #fff; text-decoration: none; cursor: pointer;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: transform .15s ease, background .2s ease, color .2s ease, border-color .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.reel-btn svg, .reel-btn .icon { width: 24px; height: 24px; }
.reel-btn:active { transform: scale(.9); }
.reel-btn:hover { background: rgba(16, 14, 26, .62); }
.reel-btn.is-liked { color: #ff4d6d; border-color: rgba(255, 77, 109, .55); background: rgba(255, 77, 109, .16); }
.reel-btn.is-liked .icon { fill: currentColor; }
.reel-btn.is-saved { color: #ffd166; border-color: rgba(255, 209, 102, .55); background: rgba(255, 209, 102, .14); }
.reel-btn.is-saved .icon { fill: currentColor; }
.reel-btn.is-liked.is-bump .icon { animation: reel-bump .35s ease-out; }
@keyframes reel-bump { 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
.reel-count { font-size: .74rem; font-weight: 700; line-height: 1; color: #fff; text-shadow: 0 1px 6px rgba(0, 0, 0, .6); }
.reel-sound[aria-pressed="true"] { background: rgba(255, 255, 255, .22); }

/* Orbe: anel que enche enquanto o reel toca e concede pontos a cada 10 s assistidos */
.reel-orb { position: relative; width: 46px; height: 46px; display: inline-flex; align-items: center; justify-content: center; margin-top: 2px; user-select: none; -webkit-tap-highlight-color: transparent; }
.reel-orb svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.reel-orb-track { fill: rgba(16, 14, 26, .42); stroke: rgba(255, 255, 255, .26); stroke-width: 3; }
.reel-orb-fill { fill: none; stroke: #ffd166; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 106.81; stroke-dashoffset: 106.81; transition: stroke-dashoffset .25s linear; }
.reel-orb-core { position: relative; width: 32px; height: 32px; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #ffd166; display: inline-flex; align-items: center; justify-content: center; pointer-events: none; }
.reel-orb-core svg { position: static; width: 18px; height: 18px; transform: none; }
.reel-orb-toast {
  position: absolute; right: 56px; top: 50%; transform: translateY(-50%); white-space: nowrap;
  padding: 5px 11px; border-radius: 999px; background: rgba(16, 14, 26, .78); color: #fff; font-size: .8rem; font-weight: 700; pointer-events: none;
}
.reel-orb.is-full .reel-orb-core { animation: reel-orb-pop .45s ease-out; }
.reel-orb.is-full .reel-orb-fill { stroke: #fff3c4; }
.reel-orb.is-done { opacity: .5; }
.reel-orb.is-done .reel-orb-fill { stroke: rgba(255, 255, 255, .4); }
.reel-orb.is-guest { cursor: pointer; }
.reel-orb.is-guest .reel-orb-core { color: rgba(255, 255, 255, .75); }
@keyframes reel-orb-pop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }

/* barra fina de progresso do vídeo, colada embaixo */
.reel-progress { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, .16); pointer-events: none; }
.reel-progress i { display: block; width: 100%; height: 100%; transform-origin: 0 50%; transform: scaleX(0); background: linear-gradient(90deg, var(--accent), #ec4899); transition: transform .25s linear; }

/* coração do duplo toque */
.reel-burst { position: absolute; z-index: 4; width: 112px; height: 112px; margin: -56px 0 0 -56px; color: #ff4d6d; pointer-events: none; animation: reel-burst .85s ease-out forwards; }
.reel-burst svg { width: 100%; height: 100%; fill: currentColor; stroke: none; filter: drop-shadow(0 8px 20px rgba(0, 0, 0, .45)); }
@keyframes reel-burst {
  0% { transform: scale(.3) rotate(-12deg); opacity: 0; }
  25% { transform: scale(1.15) rotate(6deg); opacity: 1; }
  60% { transform: scale(1) rotate(0); opacity: 1; }
  100% { transform: scale(1.35) translateY(-34px); opacity: 0; }
}

/* carregando mais */
.reel-loading {
  position: sticky; bottom: 14px; z-index: 3; width: max-content; margin: -46px auto 0; padding: 8px 14px;
  border-radius: 999px; background: rgba(16, 14, 26, .78); color: #fff; font-size: .84rem; font-weight: 600;
}
.reel-spinner { display: inline-block; width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: reel-spin .7s linear infinite; }
@keyframes reel-spin { to { transform: rotate(360deg); } }

/* ------------------------------ chips sobre o vídeo ------------------------------ */
/* Filtro ativo (Recentes, Seguindo, Salvos ou #hashtag): só aparece quando não é "Para você" */
.reels-filter {
  position: absolute; z-index: 6; top: 12px; left: 12px;
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 5px 5px 12px;
  border: 1px solid rgba(255, 255, 255, .16); border-radius: 999px;
  background: rgba(16, 14, 26, .6); color: #fff; font-size: .82rem; font-weight: 700;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.reels-filter .icon { width: 15px; height: 15px; }
.reels-filter a { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: rgba(255, 255, 255, .16); color: #fff; }
.reels-filter a .icon { width: 14px; height: 14px; }

/* dica "toque para ativar o som": some sozinha */
.reels-hint {
  position: absolute; z-index: 5; top: 14px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 8px; max-width: calc(100% - 28px); padding: 8px 14px;
  border-radius: 999px; background: rgba(16, 14, 26, .7); color: #fff; font-size: .82rem; font-weight: 700; white-space: nowrap;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  animation: reel-hint 4s ease forwards; pointer-events: none;
}
.reels-hint .icon { width: 16px; height: 16px; }
.reels-filter ~ .reels-hint { top: 56px; }
@keyframes reel-hint { 0% { opacity: 0; transform: translate(-50%, -8px); } 10%, 82% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -4px); } }

/* ------------------------------ folha "Mais opções" ------------------------------ */
.reels-sheet { position: absolute; inset: 0; z-index: 20; display: flex; align-items: flex-end; }
.reels-sheet-backdrop { position: absolute; inset: 0; background: rgba(5, 4, 12, .58); animation: reel-fade .2s ease; }
.reels-sheet-panel {
  position: relative; width: 100%; max-height: 84%; overflow-y: auto; overscroll-behavior: contain;
  padding: 8px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  border-radius: 24px 24px 0 0; border-top: 1px solid var(--border);
  background: var(--surface); color: var(--text); outline: none;
  box-shadow: 0 -20px 50px -22px rgba(0, 0, 0, .7);
  animation: reel-sheet-up .28s cubic-bezier(.2, .8, .2, 1);
}
.reels-sheet-grip { display: block; width: 40px; height: 4px; margin: 2px auto 8px; border-radius: 2px; background: var(--border-strong); }
.reels-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.reels-sheet-head h2 { font-size: 1.2rem; font-weight: 800; }
.reels-sheet-close { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: var(--hover); color: var(--text); cursor: pointer; }
.reels-sheet-close .icon { width: 18px; height: 18px; }
.reels-sheet-label { margin: 16px 2px 8px; font-size: .72rem; font-weight: 800; letter-spacing: 0; text-transform: none; color: var(--accent-text); }

.reels-sheet-reel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.reels-sheet-chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 700; font-size: .92rem; text-decoration: none; cursor: pointer;
}
.reels-sheet-chip .icon { width: 18px; height: 18px; color: var(--accent-text); }
.reels-sheet-chip:hover { background: var(--hover); }

.reels-sheet-modes { display: grid; gap: 8px; }
.reels-sheet-modes a {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px;
  border: 1px solid var(--border); border-radius: 16px; background: var(--surface-2); color: var(--text); text-decoration: none;
}
.reels-sheet-modes a > .icon { width: 40px; height: 40px; padding: 9px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); }
.reels-sheet-modes a span { display: grid; min-width: 0; }
.reels-sheet-modes a strong { font-size: .98rem; line-height: 1.2; }
.reels-sheet-modes a small { color: var(--muted); font-size: .8rem; line-height: 1.3; }
.reels-sheet-modes a:hover { background: var(--hover); }
.reels-sheet-modes a.is-active { border-color: var(--accent); background: var(--accent-soft); }
.reels-sheet-modes a.is-active > .icon { background: var(--accent); color: var(--accent-ink); }

.reels-sheet-tag { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; padding: 8px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-weight: 700; text-decoration: none; }
.reels-sheet-tag .icon { width: 16px; height: 16px; }

.reels-sheet-create { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.reels-sheet-create .btn { min-height: 48px; padding: 0 12px; }
.reels-sheet-login { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 12px; border-radius: 14px; background: var(--hover); color: var(--text-soft); font-size: .9rem; font-weight: 600; text-decoration: none; }
.reels-sheet-login .icon { color: var(--accent-text); }

@keyframes reel-sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes reel-fade { from { opacity: 0; } to { opacity: 1; } }

/* ------------------------------ vazio ------------------------------ */
.reels-empty { padding: 24px 0; }
.reels-empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 8px; }

/* ------------------------------ celular: tela cheia, só a barra de baixo ------------------------------ */
@media (max-width: 760px) {
  .reels-page { max-width: none; padding: 0; }
  .reels-stage {
    --reel-h: calc(100vh - var(--reel-bar));
    width: 100%; min-width: 0; margin: 0; border-radius: 0; box-shadow: none;
  }
  @supports (height: 100dvh) {
    .reels-stage { --reel-h: calc(100dvh - var(--reel-bar)); }
  }

  /* some o menu do topo e tudo que atrapalha a tela cheia; a barra de baixo continua */
  body.page-reels { overflow: hidden; overscroll-behavior: none; }
  .page-reels .site-header,
  .page-reels .incident-banner,
  .page-reels .ad-slot,
  .page-reels .sv-notices--header,
  .page-reels .sv-notices--content_top,
  .page-reels .sv-notices--content_bottom,
  .page-reels .sv-notices--footer,
  .page-reels .site-footer { display: none !important; }

  /* barra de baixo escura, combinando com o vídeo */
  .page-reels .bottom-nav { background: rgba(10, 9, 18, .86); border-top-color: rgba(255, 255, 255, .08); }
  .page-reels .bottom-nav a { color: rgba(255, 255, 255, .62); }
  .page-reels .bottom-nav a[aria-current="page"] { color: #fff; }

  .reel-info { left: 14px; right: 72px; bottom: 18px; }
  .reels-filter { top: max(12px, env(safe-area-inset-top, 0px)); }
  .reels-hint { top: max(14px, env(safe-area-inset-top, 0px)); }
  .reels-filter ~ .reels-hint { top: calc(max(12px, env(safe-area-inset-top, 0px)) + 44px); }
}

/* celular baixo (paisagem ou tela curta): botões menores para a coluna caber */
@media (max-height: 640px) {
  .reel-rail { gap: 8px; bottom: 14px; }
  .reel-btn { width: 40px; height: 40px; }
  .reel-btn svg, .reel-btn .icon { width: 20px; height: 20px; }
  .reel-orb { width: 40px; height: 40px; }
  .reel-orb-core { width: 28px; height: 28px; }
  .reel-count { font-size: .7rem; }
  .reel-info { gap: 6px; }
  .reel-desc { -webkit-line-clamp: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .reels-feed { scroll-behavior: auto; }
  .reel-orb-fill, .reel-progress i, .reel-btn, .reel-follow { transition: none; }
  .reel-play, .reels-sheet-backdrop, .reels-sheet-panel, .reel-burst, .reel-spinner, .reel-btn.is-liked.is-bump .icon, .reel-orb.is-full .reel-orb-core { animation: none; }
  .reels-hint { animation: none; }
  .reel-burst { display: none; }
}

/* alpha.104: sem reels, o aviso ficava colado nas bordas da tela (a página dos reels não tem margem lateral
   porque o vídeo ocupa a tela toda). O aviso ganha margem, largura de leitura e fica no meio da tela. */
.reels-page > .reels-empty { width: min(640px, calc(100% - 2 * var(--gutter, 16px))); margin: clamp(24px, 8vh, 80px) auto; padding: 0; }
