/* ===================================================
   BLOG SONODA PONTO — post.css
   Estilos exclusivos da página de detalhe do post
   =================================================== */

/* ====================================================
   ENTRANCE ANIMATIONS
   ==================================================== */
@keyframes post-hero-img-scale {
  from { transform: scale(1.07); }
  to   { transform: scale(1); }
}
@keyframes post-rise {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

.post-hero-img { animation: post-hero-img-scale 1.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) both; }

.post-hero-overlay .badge-theme    { animation: post-rise 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.12s both; }
.post-hero-overlay h1              { animation: post-rise 0.7s  cubic-bezier(0.22, 1, 0.36, 1) 0.28s both; }
.post-hero-overlay .linha-fina     { animation: post-rise 0.7s  cubic-bezier(0.22, 1, 0.36, 1) 0.44s both; }
.post-hero-overlay .post-meta-hero { animation: post-rise 0.7s  cubic-bezier(0.22, 1, 0.36, 1) 0.60s both; }

/* Stagger delays para colunas do layout (usadas com data-anim) */
.post-anim-1 { transition-delay: 0.04s; }
.post-anim-2 { transition-delay: 0.16s; }
.post-anim-3 { transition-delay: 0.28s; }

/* Hero do artigo */
body.blog-body {
  overflow-x: hidden;
}
.post-hero {
  position: relative;
  overflow: hidden;
  background: var(--brand-primary);
  min-height: 300px;
}
.post-hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0.88;
}
.post-hero-overlay {
  position: relative;
  z-index: 1;
  min-height: 300px;
  background: linear-gradient(to top, rgba(3,47,90,0.92) 0%, rgba(3,47,90,0.55) 40%, rgba(3,47,90,0.1) 70%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 72px 40px 40px;
}
.post-hero-overlay > * {
  min-width: 0;
  max-width: 100%;
}
.post-hero-overlay h1 {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  color: #fff;
  margin: 0 0 10px;
  max-width: 800px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
  overflow-wrap: anywhere;
  word-break: break-word;
}
.post-hero-overlay .linha-fina {
  font-family: var(--font-ui);
  font-size: 1rem;
  color: rgba(255,255,255,0.85);
  margin: 0 0 16px;
  max-width: 700px;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.post-meta-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.post-meta-hero span {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.75);
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.post-meta-hero span i { margin-right: 4px; }
.user-avatar {
  width: var(--avatar-size, 36px);
  height: var(--avatar-size, 36px);
  min-width: var(--avatar-size, 36px);
  border-radius: 50%;
  overflow: hidden;
  background: var(--brand-primary);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: calc(var(--avatar-size, 36px) * 0.4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Content Layout */
.post-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr) 280px;
  gap: 34px;
  max-width: 1250px;
  margin: 22px auto 40px;
  padding: 0 20px;
}
.post-layout > * {
  min-width: 0;
}
article {
  min-width: 0;
}
.post-author-box,
.newsletter-section,
.post-sidebar-box,
.post-newsletter-card {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}
@media (max-width: 900px) {
  .post-layout { grid-template-columns: 1fr; }
  .post-author-rail,
  .post-sidebar { order: -1; }
}

/* Author rail */
.post-author-rail,
.post-sidebar {
  min-width: 0;
}
.post-author-card {
  min-height: 640px;
  padding: 34px 18px 28px;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-card);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.post-author-card__avatar {
  margin-bottom: 28px;
}
.post-author-card strong {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  line-height: 1.2;
  color: var(--brand-primary);
}
.post-author-card time {
  margin-top: 6px;
  color: var(--brand-muted);
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  text-transform: lowercase;
}
.post-author-card__themes {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
}
.post-author-card__themes span {
  max-width: 100%;
  border-radius: 999px;
  background: #ff9900;
  color: #fff;
  padding: 9px 16px;
  font-family: var(--font-heading);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.15;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.post-share {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.post-share > span {
  margin-bottom: 8px;
  color: var(--brand-muted);
  font-family: var(--font-ui);
  font-size: 0.95rem;
}
.post-share__button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-decoration: none;
  transition: transform 0.18s, filter 0.18s;
}
.post-share__button:hover {
  color: #fff;
  filter: brightness(1.07);
  transform: translateY(-2px);
}
.post-share__button--facebook { background: #365899; }
.post-share__button--twitter { background: #1da1f2; }
.post-share__button--linkedin { background: #0077b5; }
.post-share__button--whatsapp { background: #25d366; }
.post-share__button--email { background: #ea4335; }

/* TOC Sidebar */
.post-sidebar-box {
  background: #fff;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px;
  position: sticky;
  top: 80px;
}
.post-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.post-sidebar .post-sidebar-box {
  position: static;
}
.post-sidebar .post-toc-card {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 108px);
  overflow-y: auto;
}
.post-newsletter-card {
  padding: 28px 20px;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-card);
}
.post-newsletter-card h3 {
  margin: 0 0 18px;
  color: var(--brand-primary);
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
}
.post-newsletter-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.post-newsletter-form input[type="email"] {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(3,47,90,0.35);
  border-radius: 999px;
  padding: 9px 15px;
  color: var(--brand-text);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  outline: none;
}
.post-newsletter-form input[type="email"]:focus {
  border-color: var(--brand-accent);
}
.post-newsletter-form label {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  color: var(--brand-muted);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  line-height: 1.35;
}
.post-newsletter-form label input {
  margin-top: 2px;
  accent-color: var(--brand-primary);
  flex: 0 0 auto;
}
.post-newsletter-form button {
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  background: #ff9900;
  color: #fff;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.18s, transform 0.18s;
}
.post-newsletter-form button:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}
.post-newsletter-form p {
  margin: 0;
  min-height: 1em;
  color: var(--brand-primary);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  line-height: 1.35;
}
/* Na página de artigo a sidebar é mais estreita — limita a largura da imagem */
.post-stat-ad { width: fit-content; }
.post-stat-ad img { width: 160px; height: auto; object-fit: unset; }
.post-sidebar-box h4 {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--brand-primary);
  margin: 0 0 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
#toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
#toc-list li { margin-bottom: 6px; }
#toc-list a {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  color: var(--brand-text);
  text-decoration: none;
  transition: color 0.2s;
  display: block;
  line-height: 1.4;
}
#toc-list a:hover { color: var(--brand-accent); }
#toc-list a.toc-sub {
  padding-left: 16px;
  opacity: 0.75;
  font-size: 0.75rem;
}

/* Article body */
.post-content {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.8;
  color: var(--brand-text);
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.post-content :where(p, h1, h2, h3, h4, h5, h6, li, blockquote, a, strong, em, span) {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.post-content > :first-child {
  margin-top: 0;
}
.post-content h2 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.625rem;
  color: var(--brand-primary);
  margin-top: 40px;
  margin-bottom: 16px;
  scroll-margin-top: 88px;
}
.post-content h3 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--brand-primary);
  margin-top: 28px;
  margin-bottom: 12px;
  scroll-margin-top: 88px;
}
.post-content a { color: var(--brand-primary); text-underline-offset: 3px; }
.post-content a:hover { color: var(--brand-accent); }
.post-content blockquote {
  border-left: 4px solid var(--brand-accent);
  background: rgba(255,153,0,0.05);
  padding: 16px 20px;
  margin: 24px 0;
  border-radius: 0 6px 6px 0;
  font-style: italic;
}
.post-content code {
  font-family: 'Courier New', monospace;
  font-size: 0.875em;
  background: rgba(3,47,90,0.06);
  padding: 2px 6px;
  border-radius: 3px;
}
.post-content pre {
  max-width: 100%;
  overflow-x: auto;
}
.post-content pre code {
  display: block;
  padding: 16px;
  font-size: 0.875em;
}
.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  margin: 20px auto;
}
.post-content iframe,
.post-content video,
.post-content table {
  max-width: 100%;
}
.post-content table {
  display: block;
  overflow-x: auto;
}
.post-content ul, .post-content ol { padding-left: 24px; }
.post-content li { margin-bottom: 6px; }

/* PDF download button */
.btn-pdf {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.9375rem;
  background: var(--brand-primary);
  color: #fff;
  padding: 12px 24px;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.2s;
  margin: 24px 0;
}
.btn-pdf:hover {
  background: var(--brand-accent);
  color: var(--brand-primary);
}

/* Related posts */
.related-section {
  padding: 48px 0;
  background: rgba(3,47,90,0.03);
  margin-top: 40px;
}
.related-section h2 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--brand-primary);
  margin: 0 0 24px;
}

@media (max-width: 600px) {
  .post-hero-overlay { padding: 24px; }
  .post-author-card {
    min-height: 0;
  }
  .post-share {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 24px;
  }
  .post-share > span {
    flex-basis: 100%;
  }
}

/* ====================================================
   DARK MODE — Transições bidirecionais (light ↔ dark)
   Devem ficar nos elementos base para funcionar nos dois sentidos
   ==================================================== */
body.blog-body,
.post-author-card,
.post-author-card strong,
.post-author-card time,
.post-sidebar-box,
.post-sidebar-box h4,
.post-newsletter-card,
.post-newsletter-card h3,
.post-author-box,
.newsletter-section,
.newsletter-section h4,
.newsletter-section p,
.post-newsletter-form input[type="email"],
.newsletter-form input[type="email"],
.post-newsletter-form label,
.post-content,
.post-content h2,
.post-content h3,
.post-content a,
.post-content blockquote,
.post-content code,
.post-content pre,
.post-content hr,
#toc-list a,
#toc-empty,
.post-share > span,
.related-section,
.related-section h2,
.btn-pdf {
  transition:
    background-color 0.35s ease,
    background     0.35s ease,
    color          0.35s ease,
    border-color   0.35s ease,
    box-shadow     0.35s ease;
}

/* ====================================================
   DARK MODE — Toggle Button
   ==================================================== */
#dark-mode-toggle {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 1001;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1.5px solid rgba(3,47,90,0.14);
  background: #ffffff;
  color: #032f5a;
  box-shadow: 0 4px 24px rgba(3,47,90,0.18), 0 1px 6px rgba(3,47,90,0.08);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  outline: none;
  animation: dm-btn-enter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.6s both;
  transition: background 0.3s ease, color 0.3s ease,
              border-color 0.3s ease, box-shadow 0.3s ease,
              transform 0.22s ease;
}
#dark-mode-toggle:hover {
  transform: scale(1.12);
  box-shadow: 0 8px 32px rgba(3,47,90,0.26), 0 2px 8px rgba(3,47,90,0.1);
}
#dark-mode-toggle:focus-visible {
  outline: 2px solid var(--brand-accent);
  outline-offset: 3px;
}
#dark-mode-toggle::after {
  content: attr(data-tooltip);
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: rgba(3,47,90,0.92);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 5px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  letter-spacing: 0.2px;
}
#dark-mode-toggle:hover::after { opacity: 1; }

@keyframes dm-btn-enter {
  from { opacity: 0; transform: scale(0.4) rotate(-90deg); }
  to   { opacity: 1; transform: scale(1)   rotate(0deg); }
}
@keyframes dm-icon-spin {
  from { opacity: 0; transform: rotate(-120deg) scale(0.5); }
  to   { opacity: 1; transform: rotate(0deg)    scale(1); }
}
.dm-icon-anim { animation: dm-icon-spin 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) both; }

/* ====================================================
   DARK MODE — Variable Overrides
   ==================================================== */
body.dark-mode {
  --brand-bg:     #0f1923;
  --brand-card:   #1a2535;
  --brand-text:   #dde6f0;
  --brand-muted:  #8da0b8;
  --shadow-card:  0 2px 20px rgba(0,0,0,0.38);
  --shadow-hover: 0 12px 40px rgba(0,0,0,0.55);
}

/* Suprimir transições no carregamento inicial */
body.dark-mode--instant,
body.dark-mode--instant * {
  transition: none !important;
}

body.dark-mode.blog-body {
  background: var(--brand-bg);
  color: var(--brand-text);
}

/* ====================================================
   DARK MODE — Toggle Button (estado escuro)
   ==================================================== */
body.dark-mode #dark-mode-toggle {
  background: #1e2d42;
  color: #ff9900;
  border-color: rgba(255,153,0,0.22);
  box-shadow: 0 4px 24px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,153,0,0.08);
}
body.dark-mode #dark-mode-toggle:hover {
  box-shadow: 0 8px 32px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,153,0,0.15);
  transform: scale(1.12);
}
body.dark-mode #dark-mode-toggle::after {
  background: rgba(255,153,0,0.15);
  color: #ff9900;
  border: 1px solid rgba(255,153,0,0.25);
}

/* ====================================================
   DARK MODE — Cards e painéis laterais
   ==================================================== */
body.dark-mode .post-author-card {
  background: var(--brand-card);
  box-shadow: var(--shadow-card);
}
body.dark-mode .post-author-card strong {
  color: #ff9900;
}
body.dark-mode .post-author-card time {
  color: var(--brand-muted);
}
body.dark-mode .post-sidebar-box {
  background: var(--brand-card);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(255,255,255,0.05);
}
body.dark-mode .post-sidebar-box h4 {
  color: #ff9900;
}
body.dark-mode .post-newsletter-card {
  background: var(--brand-card);
  box-shadow: var(--shadow-card);
}
body.dark-mode .post-newsletter-card h3 {
  color: #ff9900;
}
body.dark-mode .post-author-box {
  background: var(--brand-card) !important;
  box-shadow: var(--shadow-card) !important;
}
body.dark-mode .post-author-box strong {
  color: #ff9900 !important;
}
body.dark-mode .post-author-box p {
  color: var(--brand-muted) !important;
}

/* ====================================================
   DARK MODE — Newsletter
   ==================================================== */
body.dark-mode .newsletter-section {
  background: rgba(255,153,0,0.04);
  border-color: rgba(255,153,0,0.14);
}
body.dark-mode .newsletter-section h4 {
  color: #ff9900;
}
body.dark-mode .newsletter-section p {
  color: var(--brand-muted);
}
body.dark-mode .post-newsletter-form input[type="email"],
body.dark-mode .newsletter-form input[type="email"] {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.12);
  color: var(--brand-text);
}
body.dark-mode .post-newsletter-form input[type="email"]::placeholder,
body.dark-mode .newsletter-form input[type="email"]::placeholder {
  color: var(--brand-muted);
}
body.dark-mode .post-newsletter-form input[type="email"]:focus,
body.dark-mode .newsletter-form input[type="email"]:focus {
  border-color: #ff9900;
  background: rgba(255,255,255,0.1);
  box-shadow: 0 0 0 3px rgba(255,153,0,0.15);
}
body.dark-mode .post-newsletter-form label {
  color: var(--brand-muted);
}
body.dark-mode .post-newsletter-form p[data-newsletter-msg] {
  color: #ff9900;
}

/* ====================================================
   DARK MODE — Conteúdo do artigo
   ==================================================== */
body.dark-mode .post-content {
  color: var(--brand-text);
}
body.dark-mode .post-content h2,
body.dark-mode .post-content h3 {
  color: #ff9900;
}
body.dark-mode .post-content a {
  color: #ff9900;
}
body.dark-mode .post-content a:hover {
  color: #ff9900;
}
body.dark-mode .post-content blockquote {
  background: rgba(255,153,0,0.07);
  border-left-color: #ff9900;
}
body.dark-mode .post-content code {
  background: rgba(255,255,255,0.08);
  color: #ff9900;
}
body.dark-mode .post-content pre {
  background: rgba(0,0,0,0.3);
  border-radius: 8px;
}
body.dark-mode .post-content hr {
  border-color: rgba(255,255,255,0.1);
}
body.dark-mode .post-content table th {
  background: rgba(255,255,255,0.06);
  color: var(--brand-text);
  border-color: rgba(255,255,255,0.1);
}
body.dark-mode .post-content table td {
  border-color: rgba(255,255,255,0.07);
  color: var(--brand-text);
}

/* ====================================================
   DARK MODE — Índice (TOC)
   ==================================================== */
body.dark-mode #toc-list a {
  color: var(--brand-text);
}
body.dark-mode #toc-list a:hover {
  color: #ff9900;
}
body.dark-mode #toc-empty {
  color: var(--brand-muted);
}

/* ====================================================
   DARK MODE — Compartilhamento
   ==================================================== */
body.dark-mode .post-share > span {
  color: var(--brand-muted);
}

/* ====================================================
   DARK MODE — Seção de posts relacionados
   ==================================================== */
body.dark-mode .related-section {
  background: rgba(255,255,255,0.02);
}
body.dark-mode .related-section h2 {
  color: #ff9900;
}

/* ====================================================
   DARK MODE — Botão PDF
   ==================================================== */
body.dark-mode .btn-pdf {
  background: rgba(255,153,0,0.12);
  color: #ff9900;
  border: 1px solid rgba(255,153,0,0.3);
}
body.dark-mode .btn-pdf:hover {
  background: #ff9900;
  color: #032f5a;
  border-color: #ff9900;
}

/* ====================================================
   DARK MODE — Onda do CTA
   ==================================================== */
body.dark-mode .cta-section::before {
  background: var(--brand-bg);
}

/* ====================================================
   RESPONSIVE POLISH
   ==================================================== */
@media (max-width: 900px) {
  .post-layout {
    grid-template-columns: 1fr;
    gap: 24px;
    margin-top: 18px;
    padding: 0 16px;
  }
  article {
    order: 0;
  }
  .post-author-rail {
    order: 1;
  }
  .post-sidebar {
    order: 2;
  }
  .post-author-card {
    min-height: 0;
    padding: 20px;
  }
  .post-share {
    margin-top: 18px;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
  .post-share > span {
    width: 100%;
    margin-bottom: 0;
  }
}

@media (max-width: 640px) {
  .post-hero {
    min-height: 240px;
  }
  .post-hero-overlay {
    min-height: 240px;
    padding: 54px 18px 28px;
  }
  .post-meta-hero {
    gap: 8px;
  }
  .post-content {
    overflow-wrap: anywhere;
  }
  .post-content img,
  .post-content iframe,
  .post-content video {
    max-width: 100%;
    height: auto;
  }
  .post-content table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .post-author-box {
    flex-direction: column;
  }
  .newsletter-section,
  .post-newsletter-card,
  .post-sidebar-box {
    padding: 20px;
  }
  #dark-mode-toggle {
    right: 16px;
    bottom: 16px;
  }
}
