/* ============================================================
   ARQPEDIA — Slots de monetização premium (refined)
   Skyscraper slim, in-content, native, ad refresh
   ============================================================ */

/* Skyscraper lateral SLIM (160x600) sticky em desktops largos */
.aq-side-ad {
  display: none;
  position: fixed;
  top: 100px;
  width: 160px;
  height: 600px;
  z-index: 10;
  background: transparent;
}
.aq-side-ad.left  { left: 16px; }
.aq-side-ad.right { right: 16px; }

.aq-side-ad::before {
  content: "PUBLICIDADE";
  position: absolute;
  top: -16px;
  left: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: .55rem;
  color: #8b8275;
  letter-spacing: .14em;
  opacity: 0;
  transition: opacity .2s;
}
.aq-side-ad:hover::before { opacity: .7; }

.aq-side-ad ins {
  display: block;
  width: 160px;
  height: 600px;
  background: transparent;
  overflow: hidden;
  border-radius: 8px;
}

/* Mostra DIREITO em viewports ≥1440 */
@media (min-width: 1440px) {
  .aq-side-ad.right { display: block; }
}

/* Mostra ESQUERDO só em ultrawide ≥2000 */
@media (min-width: 2000px) {
  .aq-side-ad.left { display: block; }
}

/* Esconde skyscrapers em páginas de ferramenta (têm sidebar nativa que conflita) */
body:has(aside[class*="sidebar"]) .aq-side-ad,
body:has([role="complementary"]) .aq-side-ad,
body:has(main aside) .aq-side-ad {
  display: none !important;
}

/* In-content ads native (formato fluid) */
.aq-native-ad {
  margin: 40px auto;
  max-width: 100%;
  padding: 24px 0;
  background: transparent;
  border-top: 1px solid rgba(26, 24, 20, .08);
  border-bottom: 1px solid rgba(26, 24, 20, .08);
}

/* Bottom anchor mobile — desativado (Auto Ads anchor já cuida) */
.aq-bottom-anchor { display: none !important; }
.aq-bottom-anchor.aq-hidden { display: none !important; }

/* AQ-AD card editorial — placeholder visível quando vazio */
.aq-ad {
  background: var(--aq-cream-2, #f2ede5) !important;
  border: 1px solid rgba(26, 24, 20, .08) !important;
  border-radius: 12px !important;
  padding: 28px 24px !important;
  min-height: 140px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
}
.aq-ad::before {
  content: "PUBLICIDADE";
  position: absolute !important;
  top: 10px !important;
  left: 16px !important;
  font-family: 'JetBrains Mono', monospace !important;
  font-size: .625rem !important;
  color: rgba(139, 130, 117, .9) !important;
  letter-spacing: .14em !important;
}
.aq-ad ins[data-ad-status="unfilled"]::before,
.aq-ad:not(:has(ins[data-ad-status="filled"]))::after {
  content: "Espaço reservado para anúncio responsivo";
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-size: .9375rem;
  color: rgba(139, 130, 117, .7);
}

.in-feed-ad {
  background: var(--aq-cream-2, #f2ede5) !important;
  border: 1px solid rgba(26, 24, 20, .08) !important;
  border-radius: 12px !important;
  padding: 28px 24px !important;
  min-height: 140px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
}
.in-feed-ad::before {
  content: "PUBLICIDADE — IN-FEED";
  position: absolute;
  top: 10px;
  left: 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: .625rem;
  color: rgba(139, 130, 117, .9);
  letter-spacing: .14em;
}
.in-feed-ad:not(:has(ins[data-ad-status="filled"]))::after {
  content: "Anúncio nativo entre artigos";
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-size: .9375rem;
  color: rgba(139, 130, 117, .7);
}

/* Skyscraper placeholder com label dimensão */
.aq-side-ad ins[data-ad-status="unfilled"],
.aq-side-ad ins:not([data-ad-status]) {
  background: rgba(232, 227, 218, .35) !important;
  border: 1px dashed rgba(139, 130, 117, .35) !important;
  border-radius: 8px !important;
  position: relative;
}
.aq-side-ad::after {
  content: "Anúncio 160×600";
  position: absolute;
  bottom: -22px;
  left: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: .55rem;
  color: rgba(139, 130, 117, .8);
  letter-spacing: .12em;
  opacity: .6;
}
.aq-side-ad::before { opacity: .6 !important; }

/* === Ferramentas: legibilidade premium nos cards de resultado === */
body main [class*="bg-muted"],
body main [class*="bg-card"]:not(button) {
  background: #f2ede5 !important;
  border: 1px solid rgba(26, 24, 20, .08) !important;
  border-radius: 12px !important;
}
/* Labels (Cimento 50kg, Areia Média, etc.) — mais escuro */
body main p[class*="text-sm"][class*="text-muted"],
body main p[class*="text-muted-foreground"],
body main [class*="text-muted"]:not([class*="font-bold"]):not([class*="font-mono"]) {
  color: #2f2b25 !important;
  font-weight: 500 !important;
  font-family: 'Inter Tight', system-ui, sans-serif !important;
  letter-spacing: -.01em;
}
/* Números de resultado (7.6 sacos, 0.53 m³, etc.) — Fraunces editorial */
body main p[class*="text-xl"][class*="font-mono"],
body main p[class*="font-mono"][class*="text-lg"],
body main [class*="text-2xl"],
body main [class*="text-3xl"] {
  color: #1a1814 !important;
  font-family: 'Fraunces', 'Tiempos Headline', Georgia, serif !important;
  font-weight: 500 !important;
  font-variation-settings: 'opsz' 144 !important;
  letter-spacing: -.02em !important;
  font-size: 1.5rem !important;
}
/* Resultado destacado (R$ valor total / Volume calculado) */
body main p[class*="text-2xl"][class*="font-bold"],
body main p[class*="text-3xl"][class*="font-bold"],
body main h2[class*="text-2xl"],
body main h2[class*="text-3xl"] {
  font-size: 2rem !important;
  letter-spacing: -.025em !important;
}
/* Body text geral */
body main p:not([class*="text-muted"]):not([class*="text-xl"]):not([class*="text-2xl"]):not([class*="text-3xl"]) {
  color: #1a1814 !important;
}

/* ============================================================
   Inline Tool Card — embed contextual de calculadora no post
   ============================================================ */
.aq-inline-tool {
  margin: 40px 0;
  padding: 0;
  background: transparent;
  border: 0;
}
.aq-itc-eyebrow {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .7rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #8b8275;
  margin-bottom: 10px;
}
.aq-itc-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 24px 28px;
  background: linear-gradient(135deg, #f6f1e8 0%, #efe7d8 100%);
  border: 1px solid rgba(26, 24, 20, .08);
  border-radius: 14px;
  text-decoration: none !important;
  color: #1a1814 !important;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  position: relative;
  overflow: hidden;
}
.aq-itc-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: #c4654e;
}
.aq-itc-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -16px rgba(26, 24, 20, .25);
  border-color: rgba(196, 101, 78, .35);
}
.aq-itc-title {
  font-family: 'Fraunces', 'Tiempos Headline', Georgia, serif;
  font-weight: 500;
  font-size: 1.35rem;
  line-height: 1.25;
  letter-spacing: -.02em;
  margin: 0 0 6px;
  color: #1a1814 !important;
}
.aq-itc-desc {
  font-family: 'Inter Tight', system-ui, sans-serif;
  font-size: .9375rem;
  line-height: 1.5;
  color: #4a443c;
  margin: 0;
}
.aq-itc-cta {
  font-family: 'Inter Tight', system-ui, sans-serif;
  font-weight: 600;
  font-size: .95rem;
  color: #c4654e;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.aq-itc-cta .arrow {
  transition: transform .15s ease;
}
.aq-itc-card:hover .aq-itc-cta .arrow {
  transform: translateX(4px);
}
@media (max-width: 640px) {
  .aq-itc-card {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .aq-itc-cta { justify-content: flex-end; }
}

/* ============================================================
   Author Box editorial — foto Lucas Serrano + link /sobre
   ============================================================ */
.aq-author-box {
  display: grid !important;
  grid-template-columns: 120px 1fr !important;
  gap: 24px !important;
  align-items: start !important;
  padding: 16px !important;
  margin: 48px 0 24px !important;
  background: #f2ede5 !important;
  border: 1px solid rgba(26, 24, 20, .08) !important;
  border-radius: 14px !important;
  position: relative;
  min-height: 152px;
}
.aq-author-box .author-info {
  align-self: center !important;
  padding-right: 4px;
}
.aq-author-box::before {
  content: 'AUTOR';
  position: absolute;
  top: -8px;
  left: 20px;
  background: #faf7f2;
  padding: 0 8px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .625rem;
  letter-spacing: .14em;
  color: #8b8275;
  line-height: 1;
}
.aq-author-avatar {
  display: block !important;
  width: 120px !important;
  height: 120px !important;
  min-width: 120px !important;
  min-height: 120px !important;
  max-width: 120px !important;
  max-height: 120px !important;
  aspect-ratio: 1 / 1 !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  border: 1px solid rgba(196, 101, 78, .3) !important;
  background: #f2ede5 !important;
  box-shadow: 0 6px 16px -10px rgba(26,24,20,.35) !important;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
  flex-shrink: 0 !important;
  align-self: start !important;
  margin-top: 0 !important;
}
.aq-author-avatar:hover {
  border-color: #c4654e !important;
  transform: translateY(-1px) !important;
}
/* A11y: links em texto distinguíveis sem cor */
.article-content p a,
.article-content li a,
.breadcrumbs a {
  text-decoration: underline !important;
  text-underline-offset: 2px !important;
  text-decoration-thickness: 1px !important;
}
.article-content p a:hover,
.article-content li a:hover,
.breadcrumbs a:hover {
  text-decoration-thickness: 2px !important;
}

/* A11y: contraste mínimo WCAG AA */
.breadcrumbs span { color: #5c5651 !important; opacity: 1 !important; }
.breadcrumbs a { color: #2f2b25 !important; }
.article-meta,
.article-meta span,
.article-meta time,
.article-meta strong,
.article-meta a { color: #5c5651 !important; }
.article-header .post-card-category,
a.post-card-category { color: #8b3f2e !important; }
.article-content p.internal-link a,
.article-content .internal-link a { color: #8b3f2e !important; }
figcaption,
.article-image figcaption,
.article-content figcaption { color: #5c5651 !important; }
/* Terracota em texto: escurecer pra passar AA */
.aq-author-box .author-name a,
.aq-author-box h3 a,
.aq-author-box h4 a,
.aq-author-cta,
a.aq-author-cta,
.aq-nl-eyebrow,
.aq-newsletter .aq-nl-eyebrow { color: #8b3f2e !important; }
.aq-author-box .author-name a:hover,
.aq-author-cta:hover { color: #6b2f23 !important; }
/* Mobflix CTA branca em fundo verde */
.mobflix-inline-banner .mobflix-cta-btn,
.mobflix-cta-btn { color: #fff !important; }

.aq-author-avatar img,
.article-content .aq-author-avatar img,
.aq-author-box img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: cover !important;
  object-position: 50% 50% !important;
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
}
@media (max-width: 640px) {
  .aq-author-box {
    grid-template-columns: 96px 1fr !important;
    gap: 16px !important;
    padding: 20px !important;
  }
  .aq-author-avatar {
    width: 96px !important;
    height: 96px !important;
  }
}
.aq-author-box .author-info {
  min-width: 0;
}
.aq-author-eyebrow {
  display: none; /* já tem badge "AUTOR" acima */
}
.aq-author-box h3, .aq-author-box h4 {
  margin: 0 0 8px !important;
  font-family: 'Fraunces', 'Tiempos Headline', Georgia, serif !important;
  font-weight: 500 !important;
  font-size: 1.25rem !important;
  letter-spacing: -.015em !important;
  line-height: 1.2 !important;
  color: #1a1814 !important;
}
.aq-author-box h3, .aq-author-box h4 a {
  color: inherit !important;
  text-decoration: none !important;
  transition: color .15s;
}
.aq-author-box h3, .aq-author-box h4 a:hover {
  color: #c4654e !important;
}
.aq-author-box p {
  margin: 0 0 10px !important;
  font-family: 'Inter Tight', system-ui, sans-serif !important;
  font-size: .9375rem !important;
  line-height: 1.55 !important;
  color: #4a443c !important;
}
.aq-author-cta {
  font-family: 'Inter Tight', system-ui, sans-serif;
  font-weight: 600;
  font-size: .875rem;
  color: #c4654e !important;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: gap .15s;
}
.aq-author-cta:hover {
  gap: 10px;
  color: #a85440 !important;
}
.aq-author-cta .arrow {
  transition: transform .15s;
}
.aq-author-cta:hover .arrow {
  transform: translateX(3px);
}
/* ============================================================
   Dark mode — toggle no header
   ============================================================ */
:root[data-theme="dark"] {
  --cream: #1a1814;
  --cream-2: #2f2b25;
  --cream-3: #3a342c;
  --ink: #f5f0e6;
  --ink-2: #e8e0d3;
  --warm: #c9bfaf;
  --warm-2: #9b9080;
  --terracota: #e8896f;
  --terracota-2: #d77658;
  --line: rgba(245, 240, 230, .1);
}
:root[data-theme="dark"] body { background: #1a1814; color: #f5f0e6; }
:root[data-theme="dark"] .header { background: rgba(26, 24, 20, .92) !important; }
:root[data-theme="dark"] .aq-author-box { background: #2f2b25 !important; border-color: rgba(245, 240, 230, .08) !important; }
:root[data-theme="dark"] .aq-author-box h3, .aq-author-box h4 { color: #f5f0e6 !important; }
:root[data-theme="dark"] .aq-author-box p { color: #c9bfaf !important; }
:root[data-theme="dark"] .aq-itc-card { background: linear-gradient(135deg, #2f2b25 0%, #3a342c 100%) !important; }
:root[data-theme="dark"] .aq-itc-title { color: #f5f0e6 !important; }
:root[data-theme="dark"] .aq-itc-desc { color: #c9bfaf !important; }
:root[data-theme="dark"] .aq-newsletter, :root[data-theme="dark"] .aq-newsletter-ssr { background: #2f2b25 !important; color: #f5f0e6 !important; }
:root[data-theme="dark"] .aq-nl-title { color: #f5f0e6 !important; }
:root[data-theme="dark"] .aq-nl-desc { color: #c9bfaf !important; }

/* ============================================================
   QA AdSense (2026-06) — SLOTS VAZIOS COLAPSAM, SEM CAIXA-FANTASMA
   Enquanto o AdSense não preenche (ou devolve "unfilled"), o slot
   não pode virar caixa cinza/creme nem mostrar "espaço reservado".
   Estratégia: neutro durante o load (sem fundo/borda/altura), e
   display:none assim que o AdSense marca data-ad-status="unfilled".
   NÃO colapsamos o estado pré-load (sem data-ad-status) para o
   IntersectionObserver do lazy-load continuar disparando.
   ============================================================ */

/* 1) Mata os textos-fantasma de placeholder */
.aq-ad::before,
.aq-ad::after,
.aq-ad ins[data-ad-status="unfilled"]::before,
.in-feed-ad::before,
.in-feed-ad::after,
.aq-side-ad::before,
.aq-side-ad::after { content: none !important; }

/* 2) Slot neutro enquanto não há anúncio (sem cartão cinza/creme) */
.ad-slot,
.aq-ad,
.in-feed-ad {
  background: transparent !important;
  border: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
}
.aq-side-ad ins,
.aq-side-ad ins[data-ad-status="unfilled"],
.aq-side-ad ins:not([data-ad-status]) {
  background: transparent !important;
  border: 0 !important;
}

/* 3) Colapsa quando o AdSense NÃO preenche — qualquer status != "filled"
   (cobre "unfilled" E "unfill-optimized", que reservava 300-550px de buraco). */
.ad-slot:has(ins.adsbygoogle[data-ad-status]):not(:has(ins.adsbygoogle[data-ad-status="filled"])),
.aq-ad:has(ins.adsbygoogle[data-ad-status]):not(:has(ins.adsbygoogle[data-ad-status="filled"])),
.in-feed-ad:has(ins.adsbygoogle[data-ad-status]):not(:has(ins.adsbygoogle[data-ad-status="filled"])),
.aq-side-ad:has(ins.adsbygoogle[data-ad-status]):not(:has(ins.adsbygoogle[data-ad-status="filled"])) {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

/* 4) Quando PREENCHE de verdade, devolve o respiro editorial */
.ad-slot:has(ins[data-ad-status="filled"]) { margin: 32px 0 !important; }
.aq-ad:has(ins[data-ad-status="filled"]),
.in-feed-ad:has(ins[data-ad-status="filled"]) { margin: 40px auto !important; }

/* 5) FIX CRÍTICO (2026-06-06): o <ins> in-flow é flex-item display:block dentro
   de .ad-slot{display:flex}, então colapsava para width:0 — e o lazy-loader
   (guard width<10) NUNCA disparava os anúncios. Força largura real para o push
   acontecer no mobile e no desktop. Não afeta os laterais (.aq-side-ad ins). */
.ad-slot ins.adsbygoogle {
  display: block !important;
  width: 100% !important;
  min-width: 250px;
}

/* Toggle button */
.aq-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--cream-2);
  color: var(--ink);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  margin-right: 8px;
}
.aq-theme-toggle:hover {
  border-color: var(--terracota);
  color: var(--terracota);
}
.aq-theme-toggle svg { width: 16px; height: 16px; }
.aq-theme-toggle .sun { display: none; }
.aq-theme-toggle .moon { display: block; }
:root[data-theme="dark"] .aq-theme-toggle .sun { display: block; }
:root[data-theme="dark"] .aq-theme-toggle .moon { display: none; }
