/* ==============================
   BASE
   ============================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #ffffff;
  --text: #1c1e21;
  --muted: #65676b;
  --bubble: #f0f2f5;
  --line: #e4e6eb;
  --blue: #1877f2;
  --cta: #16a34a;
  --cta-dark: #12833c;

  --page-max: 720px;
  --comments-max: 640px;

  --avatar: 36px;
  --avatar-reply: 28px;
  --avatar-gap: 8px;

  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
}

[hidden] {
  display: none !important;
}

/* ==============================
   PÁGINA
   ============================== */
.page {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding:
    max(12px, env(safe-area-inset-top))
    max(8px, env(safe-area-inset-right))
    max(28px, env(safe-area-inset-bottom))
    max(8px, env(safe-area-inset-left));
}

/* ==============================
   TÍTULO
   ============================== */
.page-title {
  margin: 4px 0 10px;
  text-align: center;
  font-weight: 900;
  font-size: clamp(1.7rem, 8.6vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  text-wrap: balance;
  overflow-wrap: break-word;
}

/* ==============================
   VSL
   ============================== */
.vsl {
  margin: 0 0 18px;
  scroll-margin-top: 8px;
}

.vsl-frame {
  width: 100%;
  margin: 0 auto;
}

/* iframe e video: proporção fixa (a proporção real vem do aspectRatio no script.js) */
.vsl-frame.is-ratio {
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--line);
}

.vsl-frame.is-ratio iframe,
.vsl-frame.is-ratio video {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* código embed (ex.: VTurb): o próprio player define o tamanho */
.vsl-frame.is-embed {
  max-width: 100%;
}

.vsl-frame.is-embed > * {
  max-width: 100%;
}

.vsl-frame.is-embed vturb-smartplayer {
  border-radius: 10px;
  overflow: hidden;
}

.vsl-placeholder {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  padding: 16px;
  background: var(--bubble);
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
}

/* ==============================
   COMENTÁRIOS
   ============================== */
.comments {
  max-width: var(--comments-max);
  margin: 0 auto;
}

.comments-count {
  margin: 0 0 14px;
  padding: 0 2px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 1rem;
  font-weight: 600;
}

.comment-list,
.replies {
  list-style: none;
  margin: 0;
  padding: 0;
}

.comment {
  margin: 0 0 14px;
}

.comment-row {
  display: flex;
  align-items: flex-start;
  gap: var(--avatar-gap);
}

.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: var(--avatar);
  height: var(--avatar);
  border-radius: 50%;
  object-fit: cover;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
}

.comment-body {
  flex: 1;
  min-width: 0;
}

.comment-bubble {
  display: inline-block;
  max-width: 100%;
  padding: 8px 12px;
  background: var(--bubble);
  border-radius: 18px;
}

.comment-name {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.comment-text {
  margin: 2px 0 0;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.comment-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 14px;
  margin: 2px 0 0 12px;
  color: var(--muted);
  font-size: 0.78rem;
}

.comment-actions button {
  padding: 7px 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.comment-actions button:hover {
  text-decoration: underline;
}

.comment-actions button.is-active {
  color: var(--blue);
}

.comment-actions button:focus-visible,
.reply-form input:focus-visible,
.reply-form button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.comment-likes {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.like-badge {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--blue);
}

.like-badge svg {
  width: 10px;
  height: 10px;
  fill: #fff;
}

/* respostas: recuadas à direita */
.replies {
  margin: 10px 0 0 calc(var(--avatar) + var(--avatar-gap));
}

.replies:empty {
  display: none;
}

.comment--reply {
  margin: 0 0 10px;
}

.comment--reply .avatar {
  width: var(--avatar-reply);
  height: var(--avatar-reply);
  font-size: 0.68rem;
}

.reply-form {
  display: flex;
  gap: 6px;
  margin: 6px 0 0;
}

.reply-form input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 16px; /* evita zoom automático no iPhone */
}

.reply-form button {
  flex: none;
  padding: 0 14px;
  border: 0;
  border-radius: 18px;
  background: var(--blue);
  color: #fff;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

/* ==============================
   BOTÃO FINAL
   ============================== */
.cta-wrap {
  display: flex;
  justify-content: center;
  margin: 24px 0 8px;
}

.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 420px;
  min-height: 60px;
  padding: 14px 20px;
  border-radius: 12px;
  background: var(--cta);
  box-shadow: 0 4px 0 var(--cta-dark);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-align: center;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.cta:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--cta-dark);
}

.cta:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 3px;
}

.noscript {
  margin: 0;
  padding: 16px;
  text-align: center;
}

/* ==============================
   DESKTOP
   ============================== */
@media (min-width: 768px) {
  :root {
    --avatar: 40px;
    --avatar-reply: 32px;
  }

  .page {
    padding-top: max(32px, env(safe-area-inset-top));
  }

  .page-title {
    margin-bottom: 16px;
  }

  .comment-text {
    font-size: 1rem;
  }

  .comment-name {
    font-size: 0.95rem;
  }

  .comment-actions {
    font-size: 0.82rem;
  }
}

/* telas muito pequenas */
@media (max-width: 340px) {
  .comment-actions {
    gap: 0 10px;
  }
}
