/* ═══════════════════════════════════════════════════════
   CYPHER-IA — Design System v1.0
   https://cypher-ia.pages.dev
   ───────────────────────────────────────────────────────
   Contrastes WCAG verificados (nunca altere esses valores):
   #fafafa / #0a0a0b  → 19.2:1 ✓ AAA
   #22c55e / #0a0a0b  →  8.7:1 ✓ AAA  (verde em dark)
   #166534 / #fafafa  →  6.8:1 ✓ AA   (verde em light)
   #52525b / #fafafa  →  7.4:1 ✓ AA   (texto secondary light)
   ⚠ NUNCA use #22c55e como texto em fundo branco → 2.1:1 FALHA
═══════════════════════════════════════════════════════ */

/* ── RESET ─────────────────────────────────────────── */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
img, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font: inherit; background: none; border: none; }
ul, ol { list-style: none; }

/* ── TOKENS DARK (padrão) ───────────────────────────── */
:root {
  /* Fundos */
  --bg:       #0a0a0b;
  --bg2:      #111113;
  --bg3:      #18181b;

  /* Superfícies */
  --surface:  #18181b;
  --surface2: #27272a;

  /* Brand */
  --acc:      #22c55e;
  --acc2:     #16a34a;
  --acc-dim:  rgba(34,197,94,.10);
  --acc-txt:  #22c55e;

  /* Texto */
  --ink:   #fafafa;
  --ink2:  #e4e4e7;
  --ink3:  #a1a1aa;
  --ink4:  #5c5c66;
  --ink5:  #888888;

  /* Bordas */
  --rule:  #27272a;
  --rule2: #3f3f46;

  /* Semânticas */
  --amber: #f59e0b;
  --blue:  #3b82f6;
  --teal:  #14b8a6;
  --red:   #ef4444;

  /* Tipografia */
  --sans: "DM Sans", system-ui, -apple-system, sans-serif;
  --mono: "DM Mono", "Fira Mono", "Courier New", monospace;

  /* Layout */
  --max-w:    800px;
  --header-h: 56px;
}

/* ── TOKENS LIGHT ──────────────────────────────────── */
[data-theme="light"] {
  --bg:       #fafafa;
  --bg2:      #f4f4f5;
  --bg3:      #e4e4e7;
  --surface:  #ffffff;
  --surface2: #e4e4e7;
  --acc-txt:  #166534;   /* verde escuro — único tom verde válido em light */
  --ink:      #09090b;
  --ink2:     #18181b;
  --ink3:     #52525b;
  --ink4:     #71717a;
  --rule:     #e4e4e7;
  --rule2:    #d4d4d8;
}

/* ── BASE ──────────────────────────────────────────── */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.7;
  min-height: 100vh;
}
:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ── READING PROGRESS BAR ──────────────────────────── */
#progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: var(--acc);
  z-index: 999;
  transition: width .1s linear;
  pointer-events: none;
}

/* ── MASTHEAD (barra topo — sempre escura) ─────────── */
.masthead {
  background: #18181b;
  border-bottom: 1px solid #27272a;
  padding: .35rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: .7rem;
  color: #9ca3af;
}
.masthead a { color: #9ca3af; transition: color .15s; }
.masthead a:hover { color: var(--acc); }
.masthead-socials { display: flex; gap: 1rem; }

/* ── HEADER STICKY ─────────────────────────────────── */
.site-header {
  background: #18181b;
  border-bottom: 2px solid var(--acc);
  position: sticky;
  top: 0;
  z-index: 200;
  padding: 0 1.5rem;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--acc);
  letter-spacing: -.02em;
  white-space: nowrap;
}
.logo span { color: #9ca3af; font-weight: 400; }

.site-nav {
  display: flex;
  align-items: center;
  gap: .15rem;
}
.site-nav a {
  font-size: .82rem;
  font-weight: 500;
  color: #9ca3af;
  padding: .3rem .65rem;
  border-radius: 6px;
  transition: color .15s, background .15s;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--acc);
  background: var(--acc-dim);
}

.header-actions { display: flex; align-items: center; gap: .6rem; }

.theme-btn {
  background: none;
  border: 1px solid #3f3f46;
  border-radius: 6px;
  padding: .3rem .55rem;
  color: #9ca3af;
  font-size: .85rem;
  transition: border-color .15s, color .15s;
}
.theme-btn:hover { border-color: var(--acc); color: var(--acc); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid #3f3f46;
  border-radius: 6px;
  padding: .35rem .6rem;
  color: #9ca3af;
  font-size: 1.1rem;
  line-height: 1;
}

/* ── LAYOUT ─────────────────────────────────────────── */
.page-wrap {
  padding: 2.5rem 1.5rem 5rem;
  max-width: var(--max-w);
  margin: 0 auto;
}

/* ── BREADCRUMB ─────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .78rem;
  color: var(--ink4);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--ink4); transition: color .15s; }
.breadcrumb a:hover { color: var(--acc-txt); }
.breadcrumb-sep { color: var(--ink4); }

/* ── DISCLOSURE AFILIADO ────────────────────────────── */
.disclosure {
  background: rgba(245,158,11,.07);
  border: 1px solid rgba(245,158,11,.2);
  border-radius: 6px;
  padding: .55rem .85rem;
  font-size: .78rem;
  color: var(--ink3);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}
.disclosure::before { content: '⚠ '; color: var(--amber); }

/* ── ZONAS DE AD ────────────────────────────────────── */
.ad-zone {
  margin: 1.75rem 0;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg2);
  border: 1px dashed var(--rule2);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: .65rem;
  color: var(--ink4);
  text-align: center;
}

/* ── CONTEÚDO DO ARTIGO ─────────────────────────────── */
.article-content h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  margin: 2.25rem 0 .75rem;
  letter-spacing: -.02em;
  scroll-margin-top: calc(var(--header-h) + 16px);
}
.article-content h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink2);
  margin: 1.75rem 0 .5rem;
  scroll-margin-top: calc(var(--header-h) + 16px);
}
.article-content p { color: var(--ink2); margin-bottom: 1rem; }
.article-content ul,
.article-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
  color: var(--ink2);
}
.article-content ul { list-style: disc; }
.article-content ol { list-style: decimal; }
.article-content li { margin-bottom: .35rem; }
.article-content a { color: var(--acc-txt); text-decoration: underline; text-underline-offset: 3px; }
.article-content a:hover { opacity: .8; }
.article-content strong { font-weight: 600; color: var(--ink); }
.article-content code {
  font-family: var(--mono);
  font-size: .85em;
  background: var(--surface2);
  padding: .1em .35em;
  border-radius: 4px;
  color: var(--acc-txt);
}
.article-content pre {
  background: var(--bg3);
  border: 1px solid var(--rule2);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.25rem;
}
.article-content pre code {
  background: none;
  padding: 0;
  font-size: .82rem;
  color: var(--ink2);
}
.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.25rem;
  font-size: .88rem;
}
.article-content th {
  background: var(--surface2);
  padding: .55rem .75rem;
  text-align: left;
  font-weight: 600;
  color: var(--ink);
  border-bottom: 2px solid var(--rule2);
}
.article-content td {
  padding: .55rem .75rem;
  color: var(--ink2);
  border-bottom: 1px solid var(--rule);
}
.article-content tr:hover td { background: rgba(255,255,255,.02); }
[data-theme="light"] .article-content tr:hover td { background: rgba(0,0,0,.02); }
.article-content blockquote {
  border-left: 3px solid var(--acc);
  padding: .75rem 1.25rem;
  margin: 1.25rem 0;
  background: var(--acc-dim);
  border-radius: 0 6px 6px 0;
  color: var(--ink2);
  font-style: italic;
}
.article-content img { border-radius: 8px; margin: 1rem 0; }

/* ── TOC (Tabela de Conteúdo) ───────────────────────── */
.toc {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
}
.toc-title {
  font-family: var(--mono);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink4);
  margin-bottom: .65rem;
}
.toc ol { list-style: none; padding: 0; counter-reset: toc; }
.toc li { counter-increment: toc; font-size: .85rem; margin-bottom: .3rem; }
.toc a { color: var(--ink3); transition: color .15s; }
.toc a::before {
  content: counter(toc) '. ';
  color: var(--ink4);
  font-family: var(--mono);
  font-size: .75rem;
}
.toc a:hover { color: var(--acc-txt); }

/* ── FAQ ACCORDION ──────────────────────────────────── */
.faq { margin-top: 1.5rem; }
.faq-item { border-bottom: 1px solid var(--rule); }
.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 0;
  font-weight: 600;
  font-size: .92rem;
  color: var(--ink);
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}
.faq-icon {
  flex-shrink: 0;
  color: var(--acc-txt);
  font-size: 1.2rem;
  line-height: 1;
  transition: transform .2s;
}
.faq-item.open .faq-icon { transform: rotate(45deg); }
.faq-answer {
  font-size: .88rem;
  color: var(--ink3);
  line-height: 1.6;
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease, padding-bottom .3s ease;
}
.faq-item.open .faq-answer {
  max-height: 500px;
  padding-bottom: .9rem;
}

/* ── AFFILIATE BOX ──────────────────────────────────── */
.affiliate-box {
  background: var(--surface);
  border: 1px solid var(--rule2);
  border-left: 3px solid var(--acc);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1.75rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.affiliate-box-info { flex: 1; min-width: 180px; }
.affiliate-box-name { font-weight: 700; font-size: .95rem; color: var(--ink); margin-bottom: .25rem; }
.affiliate-box-desc { font-size: .82rem; color: var(--ink3); }
.btn-affiliate {
  display: inline-block;
  background: var(--acc);
  color: #000;
  font-weight: 700;
  font-size: .82rem;
  padding: .5rem 1.1rem;
  border-radius: 6px;
  white-space: nowrap;
  transition: background .15s;
  flex-shrink: 0;
}
.btn-affiliate:hover { background: var(--acc2); color: #000; }

/* ── CALLOUTS ───────────────────────────────────────── */
.note {
  display: flex;
  gap: .6rem;
  padding: .7rem 1rem;
  border-radius: 6px;
  font-size: .82rem;
  line-height: 1.55;
  margin: 1.1rem 0;
}
.note.tip  { background: var(--acc-dim); border: 1px solid rgba(34,197,94,.2); color: var(--ink3); }
.note.warn { background: rgba(245,158,11,.07); border: 1px solid rgba(245,158,11,.2); color: var(--ink3); }
.note.info { background: rgba(59,130,246,.06); border: 1px solid rgba(59,130,246,.2); color: var(--ink3); }
.note.tip::before  { content: '✦'; color: var(--acc-txt); flex-shrink: 0; }
.note.warn::before { content: '⚠'; color: var(--amber);   flex-shrink: 0; }
.note.info::before { content: 'ℹ'; color: var(--blue);    flex-shrink: 0; }

/* ── COOKIE BAR LGPD ────────────────────────────────── */
#cookie-bar {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 2rem));
  background: var(--surface);
  border: 1px solid var(--rule2);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
}
#cookie-bar[hidden] { display: none; }
.cookie-text { font-size: .8rem; color: var(--ink3); line-height: 1.5; flex: 1; }
.cookie-text a { color: var(--acc-txt); text-decoration: underline; }
.cookie-actions { display: flex; gap: .5rem; flex-shrink: 0; }
.btn-cookie-accept {
  background: var(--acc);
  color: #000;
  border-radius: 6px;
  padding: .4rem .85rem;
  font-size: .78rem;
  font-weight: 600;
  transition: background .15s;
  white-space: nowrap;
}
.btn-cookie-accept:hover { background: var(--acc2); }
.btn-cookie-essential {
  background: none;
  border: 1px solid var(--rule2);
  border-radius: 6px;
  padding: .4rem .85rem;
  font-size: .78rem;
  color: var(--ink3);
  transition: border-color .15s;
  white-space: nowrap;
}
.btn-cookie-essential:hover { border-color: var(--ink3); }

/* ── STICKY CTA NEWSLETTER ──────────────────────────── */
#sticky-cta {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--surface);
  border: 1px solid rgba(34,197,94,.3);
  border-radius: 10px;
  padding: .9rem 1rem;
  max-width: 260px;
  z-index: 400;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .3s, transform .3s;
  pointer-events: none;
}
#sticky-cta.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.sticky-cta-close {
  position: absolute;
  top: .35rem;
  right: .5rem;
  color: var(--ink4);
  font-size: 1.1rem;
  line-height: 1;
}
.sticky-cta-title {
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: .25rem;
  padding-right: 1.2rem;
}
.sticky-cta-sub { font-size: .74rem; color: var(--ink3); margin-bottom: .7rem; }
.btn-cta {
  display: block;
  width: 100%;
  background: var(--acc);
  color: #000;
  border-radius: 6px;
  padding: .45rem;
  font-size: .78rem;
  font-weight: 700;
  text-align: center;
  transition: background .15s;
}
.btn-cta:hover { background: var(--acc2); color: #000; }

/* ── FOOTER ─────────────────────────────────────────── */
.site-footer {
  background: #18181b;
  border-top: 1px solid #27272a;
  padding: 2.5rem 1.5rem;
  margin-top: 4rem;
}
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: space-between;
  align-items: flex-start;
}
.footer-brand .logo { font-size: .9rem; margin-bottom: .45rem; }
.footer-brand p { font-size: .75rem; color: #6b7280; max-width: 220px; line-height: 1.5; }
.footer-links { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; }
.footer-links a { font-size: .78rem; color: #6b7280; transition: color .15s; }
.footer-links a:hover { color: var(--acc); }
.footer-copy {
  width: 100%;
  font-family: var(--mono);
  font-size: .68rem;
  color: #4b5563;
  padding-top: 1.5rem;
  border-top: 1px solid #27272a;
  margin-top: .5rem;
}

/* ── SCROLL TO TOP ──────────────────────────────────── */
#scroll-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 40px;
  height: 40px;
  background: var(--surface2);
  border: 1px solid var(--rule2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink3);
  font-size: 1rem;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
#scroll-top.visible { opacity: 1; pointer-events: auto; }
#scroll-top:hover { border-color: var(--acc); color: var(--acc-txt); }

/* ── TAGS / BADGES ──────────────────────────────────── */
.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: .65rem;
  padding: .15rem .45rem;
  border-radius: 4px;
  font-weight: 500;
}
.tag-green  { background: var(--acc-dim);               color: var(--acc-txt); }
.tag-amber  { background: rgba(245,158,11,.1);           color: var(--amber);   }
.tag-blue   { background: rgba(59,130,246,.1);           color: var(--blue);    }
.tag-red    { background: rgba(239,68,68,.12);           color: var(--red);     }

/* ── ACESSIBILIDADE ─────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}

/* ── RESPONSIVO ─────────────────────────────────────── */
@media (max-width: 640px) {
  :root { --header-h: 52px; }

  .site-nav { display: none; }
  .nav-toggle { display: flex; align-items: center; }

  .site-nav.open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0;
    background: #18181b;
    border-bottom: 1px solid #27272a;
    padding: .75rem 1.5rem 1rem;
    gap: .1rem;
    z-index: 199;
  }
  .site-nav.open a {
    padding: .5rem .75rem;
    font-size: .9rem;
  }

  .page-wrap { padding: 1.5rem 1rem 4rem; }
  #cookie-bar { flex-direction: column; text-align: center; bottom: .75rem; }
  .cookie-actions { justify-content: center; }
  #sticky-cta { bottom: 1rem; right: 1rem; max-width: calc(100vw - 2rem); }
  .affiliate-box { flex-direction: column; }
  .btn-affiliate { width: 100%; text-align: center; display: block; }
}
