/* ═══════════════════════════════════════════════════
   Blog público — tema sobre o Bootstrap 5.3
   ═══════════════════════════════════════════════════

   Este arquivo NÃO reimplementa o que o Bootstrap já entrega. Ele faz duas
   coisas: (1) mapeia a paleta terrosa do site nas variáveis --bs-*, e (2)
   estiliza o que o Bootstrap não tem (cabeçalho, hero, card de artigo, corpo
   do post, rodapé).

   Precisa ser carregado DEPOIS do bootstrap.min.css — é a ordem que faz o
   tema vencer o Reboot sem precisar de truque de especificidade em cada
   regra. O admin tem folha própria: admin.css.
   ═══════════════════════════════════════════════════ */

/* ── tokens do site ────────────────────────────── */

:root {
  /* palette */
  --bg:           #faf9f8;
  --surface:      #ffffff;
  --fg:           #221d21;
  --fg-secondary: #433d3d;
  --muted:        #b7aea5;
  --border:       #d5cdc6;
  --border-light: #ede8e3;

  /* accent — laranja terroso */
  --accent:       #f77014;
  --accent-hover: #e33c08;
  --accent-light: #fff0e6;
  --accent-subtle:#ffe4d0;

  /* semantic */
  --success:      #059669;
  --warning:      #d97706;
  --danger:       #dc2626;
  --danger-hover: #b91c1c;

  /* misc */
  --radius:       12px;
  --radius-sm:    8px;
  --radius-xs:    6px;
  --shadow-sm:    0 1px 2px rgba(0,0,0,.04);
  --shadow:       0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:    0 4px 6px rgba(0,0,0,.04), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg:    0 10px 25px rgba(0,0,0,.06), 0 4px 10px rgba(0,0,0,.04);
  --shadow-xl:    0 20px 40px rgba(0,0,0,.08);
}

/* ── a paleta do site nas variáveis do Bootstrap ── */

:root,
[data-bs-theme="light"] {
  --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-line-height: 1.7;
  --bs-body-color: #221d21;
  --bs-body-color-rgb: 34, 29, 33;
  --bs-body-bg: #faf9f8;
  --bs-body-bg-rgb: 250, 249, 248;
  --bs-emphasis-color: #221d21;
  --bs-secondary-color: #433d3d;
  --bs-secondary-bg: #ede8e3;
  --bs-tertiary-color: #b7aea5;
  --bs-tertiary-bg: #f4f1ee;
  --bs-border-color: #d5cdc6;
  --bs-border-color-translucent: rgba(34, 29, 33, .12);

  --bs-primary: #f77014;
  --bs-primary-rgb: 247, 112, 20;
  --bs-primary-text-emphasis: #e33c08;
  --bs-primary-bg-subtle: #fff0e6;
  --bs-primary-border-subtle: #ffe4d0;

  --bs-success: #059669;
  --bs-success-rgb: 5, 150, 105;
  --bs-danger: #dc2626;
  --bs-danger-rgb: 220, 38, 38;
  --bs-warning: #d97706;
  --bs-warning-rgb: 217, 119, 6;

  --bs-link-color: #f77014;
  --bs-link-color-rgb: 247, 112, 20;
  --bs-link-hover-color: #e33c08;
  --bs-link-hover-color-rgb: 227, 60, 8;

  --bs-border-radius: .75rem;
  --bs-border-radius-sm: .5rem;
  --bs-border-radius-lg: 1rem;
  --bs-border-radius-xl: 1.25rem;

  --bs-focus-ring-color: rgba(247, 112, 20, .3);
}

/* ── base ──────────────────────────────────────── */

/* O container do Bootstrap salta em degraus (540/720/960/1140). O site usa
   uma medida única, fluida até 1040px — a largura do layout original. */
.container { max-width: 1040px; padding-left: 20px; padding-right: 20px; }

html { scroll-behavior: smooth; }

body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* O Reboot sublinha todo link. No site, só o texto do artigo sublinha. */
a { text-decoration: none; transition: color .15s; }

h1, .h1 { font-size: 2rem;   font-weight: 800; letter-spacing: -.02em; }
h2, .h2 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.01em; }
h3, .h3 { font-size: 1.15rem; font-weight: 600; }
h4, .h4 { font-size: 1.05rem; font-weight: 600; }
h5, .h5 { font-size: 1rem;    font-weight: 600; }
h6, .h6 { font-size: .95rem;  font-weight: 600; }

/* ── componentes do Bootstrap na cor da marca ──── */

.btn-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--accent);
  --bs-btn-border-color: var(--accent);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--accent-hover);
  --bs-btn-hover-border-color: var(--accent-hover);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--accent-hover);
  --bs-btn-active-border-color: var(--accent-hover);
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: var(--accent);
  --bs-btn-disabled-border-color: var(--accent);
  --bs-btn-focus-shadow-rgb: 247, 112, 20;
  font-weight: 600;
}

.btn-outline-primary {
  --bs-btn-color: var(--accent);
  --bs-btn-border-color: var(--accent);
  --bs-btn-hover-color: var(--accent);
  --bs-btn-hover-bg: var(--accent-light);
  --bs-btn-hover-border-color: var(--accent);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--accent);
  --bs-btn-active-border-color: var(--accent);
  --bs-btn-focus-shadow-rgb: 247, 112, 20;
  font-weight: 600;
}

.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color);
}

.pagination {
  --bs-pagination-color: var(--fg-secondary);
  --bs-pagination-border-color: var(--border);
  --bs-pagination-hover-color: var(--accent);
  --bs-pagination-hover-bg: var(--accent-light);
  --bs-pagination-hover-border-color: var(--accent);
  --bs-pagination-focus-color: var(--accent);
  --bs-pagination-focus-bg: var(--accent-light);
  --bs-pagination-focus-box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color);
  --bs-pagination-active-bg: var(--accent);
  --bs-pagination-active-border-color: var(--accent);
  --bs-pagination-border-radius: var(--radius-sm);
}

/* ── cabeçalho ─────────────────────────────────── */

.site-header {
  background: linear-gradient(135deg, #221d21 0%, #3d2e1f 100%);
  box-shadow: 0 4px 20px rgba(0,0,0,.25), 0 1px 3px rgba(0,0,0,.15);
}
.site-header .navbar {
  --bs-navbar-color: rgba(255,255,255,.78);
  --bs-navbar-hover-color: #fff;
  --bs-navbar-active-color: #fff;
  --bs-navbar-brand-color: #fff;
  --bs-navbar-brand-hover-color: #fff;
  --bs-navbar-toggler-border-color: transparent;
}

.site-logo { font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; }
.site-logo:hover { opacity: .85; }
.site-tagline {
  font-weight: 400; font-size: .66rem; color: rgba(255,255,255,.55);
  text-transform: uppercase; letter-spacing: .08em;
}

.site-header .nav-link {
  padding: .5rem 1.125rem; border-radius: 50rem;
  font-size: .9rem; font-weight: 500;
  transition: background .2s, color .2s;
}
.site-header .nav-link:hover,
.site-header .nav-link:focus-visible { background: rgba(255,255,255,.12); }

.search-group {
  width: auto;
  background: rgba(255,255,255,.1); border-radius: 50rem; padding: 2px;
  transition: background .2s, box-shadow .2s;
}
.search-group:focus-within {
  background: rgba(255,255,255,.18);
  box-shadow: 0 0 0 3px rgba(247,112,20,.35);
}
.search-group .input-group-text { color: rgba(255,255,255,.5); }
.search-group .form-control {
  width: 150px; flex: 0 1 150px; color: #fff; font-size: .875rem;
}
.search-group .form-control::placeholder { color: rgba(255,255,255,.4); }
.search-group .form-control:focus { color: #fff; border-color: transparent; box-shadow: none; }

/* ── hero ──────────────────────────────────────── */

.hero {
  padding: 64px 0 48px; text-align: center;
  position: relative; overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% -10%, var(--accent-light), transparent);
  opacity: .5; pointer-events: none; z-index: -1;
}
.hero h1 { font-size: 2.8rem; margin-bottom: 12px; }
.hero p  { font-size: 1.15rem; color: var(--fg-secondary); max-width: 560px; margin: 0 auto 24px; }

/* ── título de seção ───────────────────────────── */

.section-title {
  font-size: 1.35rem; padding-bottom: 10px;
  border-bottom: 2px solid var(--accent-light); display: inline-block;
}

/* ── card de artigo (sobre o .card do Bootstrap) ── */

.article-card {
  height: 100%;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.article-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-subtle);
}

.article-card-img { display: block; overflow: hidden; }
.article-card .card-img-top {
  height: 180px; object-fit: cover;
  transition: transform .35s;
}
.article-card:hover .card-img-top { transform: scale(1.04); }

.article-card-cat {
  align-self: flex-start;
  background: var(--accent-light); color: var(--accent);
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
}
.article-card-cat:hover { background: var(--accent-subtle); color: var(--accent); }

.article-card .card-title { line-height: 1.3; }
.article-card .card-title a { color: var(--fg); }
/* O link do título se anuncia pela cor no hover do card — nunca sublinhado. */
.article-card:hover .card-title a,
.article-card .card-title a:hover { color: var(--accent); }
.article-card .card-title a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px;
}

.article-card-summary {
  color: var(--fg-secondary); font-size: .9rem; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── marcador de lido ──────────────────────────── */

.read-badge {
  display: none; align-items: center; gap: 6px;
  width: fit-content; background: #ecfdf5; color: var(--success);
  font-size: .8rem; font-weight: 700; border-radius: 50rem;
  padding: .3rem .7rem;
}
.read-badge.is-read { display: inline-flex; }

/* ── página de categorias ──────────────────────── */

.cat-card {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 22px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); height: 100%;
  transition: box-shadow .18s, border-color .18s, transform .18s;
}
.cat-card:hover {
  box-shadow: var(--shadow-md); border-color: var(--accent);
  transform: translateY(-2px);
}
/* O ícone não encolhe quando a descrição é longa. */
.cat-card-icon { flex: 0 0 44px; line-height: 0; }
.cat-card-icon svg { width: 44px; height: 44px; display: block; }
.cat-card-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cat-card-title {
  font-size: 1.15rem; font-weight: 700; color: var(--fg); letter-spacing: -.01em;
}
.cat-card:hover .cat-card-title { color: var(--accent); }
.cat-card-desc { font-size: .9rem; line-height: 1.6; color: var(--fg-secondary); }

/* ── páginas de texto (sobre, termos, privacidade) ── */

.page { max-width: 760px; margin: 0 auto; padding: 40px 0 60px; }
.page h2 { font-size: 1.2rem; margin: 32px 0 10px; }
.page p, .page li { line-height: 1.75; color: var(--fg-secondary); }

/* ── artigo ────────────────────────────────────── */

.post { max-width: 780px; margin: 0 auto; padding: 40px 0 60px; }

.post-cover {
  width: 100%; max-height: 420px; object-fit: cover;
  border-radius: var(--radius);
}

.post h1 { font-size: 2.4rem; line-height: 1.2; }

.post-meta {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  color: var(--muted); font-size: .875rem;
  padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.post-meta-sep { color: var(--border); }
.post-cat {
  color: var(--accent); font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; font-size: .8rem;
}
.post-cat:hover { color: var(--accent-hover); }

.post-summary {
  font-size: 1.1rem; color: var(--fg-secondary); line-height: 1.65;
  padding: 16px 20px; background: var(--accent-light);
  border-radius: var(--radius-sm); border-left: 3px solid var(--accent);
}

/* conteúdo do artigo (vem do TinyMCE) */
.post-content { font-size: 1.05rem; line-height: 1.8; color: var(--fg); }
.post-content h2 { font-size: 1.6rem; margin: 36px 0 12px; }
.post-content h3 { font-size: 1.25rem; margin: 28px 0 8px; }
.post-content ul, .post-content ol { margin-bottom: 18px; padding-left: 24px; }
.post-content li { margin-bottom: 6px; }
/* Único lugar do site onde link é sublinhado: no meio do texto corrido. */
.post-content a { text-decoration: underline; text-underline-offset: 3px; }
.post-content blockquote {
  border-left: 3px solid var(--accent); padding: 12px 18px; margin: 20px 0;
  background: var(--accent-light); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--fg-secondary); font-style: italic;
}
.post-content pre {
  background: #f6f4f2; padding: 14px 0; border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow-x: auto; margin: 20px 0;
  font-size: .875rem; line-height: 1.6;
}
.post-content code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .875em; }
.post-content :not(pre) > code {
  background: var(--accent-light); color: var(--accent);
  padding: 2px 6px; border-radius: 4px; font-weight: 500;
}
.post-content img { border-radius: var(--radius-sm); margin: 16px 0; max-width: 100%; }
.post-content hr { border-top: 1px solid var(--border); margin: 32px 0; opacity: 1; }
.post-content table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: .92rem; }
.post-content th, .post-content td { border: 1px solid var(--border); padding: 10px 14px; text-align: left; }
.post-content th { background: var(--accent-light); font-weight: 600; }

/* Respostas dos exercícios (bloco collapse gerado pelo MCP) */
.post-content .answer-block {
  border-left: 4px solid #2e7d32; background: #f1f8f2;
  padding: 12px 16px; border-radius: 4px; margin-top: 6px;
}
.post-content .answer-badge {
  display: inline-block; font-weight: 600; color: #2e7d32; margin-right: 6px;
}

/* Numeração de linhas do highlight.js (plugin highlightjs-line-numbers).
   O plugin marca cada <td> com .hljs-ln-line + .hljs-ln-numbers/.hljs-ln-code,
   então o espaçamento tem que ser declarado NO <td> e depois do reset abaixo:
   uma regra em .hljs-ln-numbers sozinha perde para `table.hljs-ln td` por
   especificidade, e `margin` não vale nada em célula de tabela. Era isso que
   colava o número no código. */
.post-content table.hljs-ln { border-collapse: collapse; width: 100%; margin: 0; }
.post-content table.hljs-ln td { border: none; background: none; vertical-align: top; }
.post-content table.hljs-ln td.hljs-ln-numbers {
  width: 52px; min-width: 52px;
  padding: 0 10px 0 12px;
  border-right: 1px solid var(--border);
  text-align: right; color: var(--muted); user-select: none;
}
.post-content table.hljs-ln td.hljs-ln-code { padding: 0 14px 0 12px; }
/* Com a tabela cuidando do espaçamento horizontal, o <pre> só dá o vertical. */
.post-content pre:has(table.hljs-ln) { padding: 12px 0; }

/* navegação anterior/próximo */
.nav-card {
  display: flex; flex-direction: column; gap: 6px; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--fg); height: 100%;
  transition: border-color .15s, color .15s;
}
.nav-card:hover { border-color: var(--accent); color: var(--accent); }
.nav-card span { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.nav-card strong { font-size: .95rem; line-height: 1.45; }

/* painel de sugestões: separa a seção do corpo do artigo */
.related-section {
  padding: 28px; background: var(--border-light); border-radius: var(--radius);
}
/* Com o container no máximo (1000px) e a coluna de leitura em 780px sobram
   110px de cada lado: o painel usa esse espaço para caber três cards do
   tamanho dos da home, em vez de espremer três colunas na coluna de texto. */
@media (min-width: 1040px) {
  .related-section { margin-left: -110px; margin-right: -110px; }
}

/* ── reações e botão de lido ───────────────────── */

.reactions button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border: 1.5px solid var(--border); border-radius: 24px;
  background: var(--surface); color: var(--fg-secondary); cursor: pointer;
  font-size: .92rem; transition: all .15s;
}
.reactions button:hover { border-color: var(--accent); background: var(--accent-light); }
.reactions button.reacted { background: var(--accent-light); border-color: var(--accent); color: var(--accent); }

/* Marcar como lido: livro que vira "check" verde quando ativo. */
.reactions .reaction-read {
  padding: 0; width: 42px; height: 42px;
  justify-content: center; border-radius: 50%;
}
.reactions .reaction-read .bi { font-size: 19px; line-height: 1; }
.reactions .reaction-read:hover {
  border-color: var(--accent); background: var(--accent-light); color: var(--accent);
}
.reactions .reaction-read.is-read {
  background: #ecfdf5; border-color: #34d399; color: var(--success);
}
.reactions .reaction-read.is-read:hover {
  background: #d7f5e7; border-color: var(--success); color: var(--success);
}

/* ── rodapé ────────────────────────────────────── */

.site-footer { background: var(--fg); }
.site-footer .footer-heading { color: #f0ebe4; }
.site-footer .footer-text { color: #cbd5e1; }
.site-footer .nav-link { color: #b7aea5; padding-left: 0; padding-right: 0; }
.site-footer .nav-link:hover, .site-footer .nav-link:focus { color: var(--accent); }
.site-footer .footer-bottom { border-top: 1px solid #5c5252; }
.site-footer .form-control { background: #2d262d; border-color: #5c5252; color: #e0d8d0; }
.site-footer .form-control::placeholder { color: #8c7e7e; }

#newsletter-msg.ok  { color: #34d399; }
#newsletter-msg.err { color: #f87171; }

/* ── páginas de erro e manutenção ──────────────── */

.status-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 40px 24px;
}
/* Só o ícone grande do topo — os do botão seguem o tamanho do texto. */
.status-page .status-icon { font-size: 72px; line-height: 1; color: var(--muted); display: block; }
.status-page .status-code { font-size: 5rem; font-weight: 800; line-height: 1; margin: 8px 0; }
.status-page .status-brand {
  font-size: .8rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.status-page p { color: var(--fg-secondary); max-width: 440px; margin-inline: auto; }

/* ── responsive ────────────────────────────────── */

@media (max-width: 768px) {
  .search-group, .search-group .form-control { width: 100%; flex: 1 1 auto; }
  .hero { padding: 40px 0 32px; }
  .hero h1 { font-size: 2rem; }
  .post h1 { font-size: 1.7rem; }
  .related-section { padding: 20px 16px; }
}
