/* ==========================================================================
   EscalaCAD — Blog Técnico Editorial
   Tipografia: Plus Jakarta Sans (títulos) + Inter (corpo / números tabulares)
   ========================================================================== */

:root {
  --bg-canvas: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-subtle: #F1F5F9;
  --brand-navy: #0B1F3A;
  --brand-blue: #1351B4;
  --brand-blue-dark: #0E3F8F;
  --brand-blue-soft: #EFF6FF;
  --brand-green: #009C3B;
  --brand-green-soft: #ECFDF5;
  --brand-gold: #FFCD07;
  --brand-gold-soft: #FEFCE8;
  --accent-red-soft: #FEF2F2;
  --accent-red: #991B1B;
  --ink-primary: #0F172A;
  --ink-secondary: #334155;
  --ink-muted: #64748B;
  --border-subtle: #E2E8F0;
  --border-strong: #CBD5E1;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  --shadow-sm: 0 2px 8px rgba(11, 31, 58, 0.045);
  --shadow-md: 0 14px 30px rgba(11, 31, 58, 0.085);
  --font-display: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--ink-primary);
  background: var(--bg-canvas);
  line-height: 1.65;
  overflow-x: clip;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  padding: 10px 14px; background: var(--brand-navy); color: #FFFFFF;
  font-weight: 700; border-radius: 8px; z-index: 100; text-decoration: none;
}
.skip-link:focus { left: 12px; top: 12px; }

.container { width: 100%; max-width: 1140px; margin-inline: auto; padding-inline: 16px; }

/* ---------- Cabeçalho ---------- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-subtle);
}
.header-inner {
  min-height: 64px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--brand-navy); min-width: 0; flex-shrink: 1; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; background: #FFFFFF;
  border: 1px solid var(--border-subtle); display: grid; place-items: center;
  flex-shrink: 0; box-shadow: var(--shadow-sm);
}
.brand-stack { display: flex; flex-direction: column; line-height: 1.04; min-width: 0; }
.brand-name { font-family: var(--font-display); font-size: 0.98rem; font-weight: 800; letter-spacing: -0.025em; color: var(--brand-navy); white-space: nowrap; }
.brand-name span { color: var(--brand-blue); }
.brand-cat { font-size: 0.64rem; font-weight: 700; letter-spacing: 0.14em; color: var(--brand-green); margin-top: 2px; }

.header-nav { display: none; align-items: center; gap: 4px; }
.header-nav a {
  padding: 6px 12px; border-radius: var(--radius-pill); text-decoration: none;
  font-size: 0.84rem; font-weight: 600; color: var(--ink-secondary); white-space: nowrap;
}
.header-nav a:hover { background: var(--bg-subtle); color: var(--brand-navy); }
.header-nav a.is-current { background: var(--brand-blue-soft); color: var(--brand-blue); }
@media (min-width: 860px) { .header-nav { display: inline-flex; } }

.header-actions { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 8px 15px; border-radius: var(--radius-pill);
  border: 1px solid transparent; font-family: var(--font-sans); font-size: 0.85rem;
  font-weight: 650; letter-spacing: -0.01em; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color 0.14s ease, border-color 0.14s ease, transform 0.1s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand-blue); color: #FFFFFF; box-shadow: 0 4px 12px rgba(19, 81, 180, 0.22); }
.btn-primary:hover { background: var(--brand-blue-dark); }
.btn-dark { background: var(--brand-navy); color: #FFFFFF; }
.btn-dark:hover { background: #163156; }
.btn-gold { background: var(--brand-gold); color: var(--brand-navy); font-weight: 750; }
.btn-gold:hover { background: #F4C000; }
.btn-outline { background: #FFFFFF; color: var(--brand-navy); border-color: var(--border-strong); }
.btn-outline:hover { background: var(--bg-subtle); border-color: var(--brand-blue); color: var(--brand-blue); }

.label-full { display: none; }
@media (min-width: 600px) { .label-short { display: none; } .label-full { display: inline; } }

/* ---------- Pílulas ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: var(--radius-pill);
  font-size: 0.76rem; font-weight: 600;
}
.pill-blue { background: var(--brand-blue-soft); color: var(--brand-blue); border: 1px solid #BFDBFE; }
.pill-green { background: var(--brand-green-soft); color: #047857; border: 1px solid #A7F3D0; }
.pill-gold { background: var(--brand-gold-soft); color: #854D0E; border: 1px solid #FDE68A; }
.pill-slate { background: var(--bg-subtle); color: var(--ink-secondary); border: 1px solid var(--border-subtle); }

/* ---------- Índice do Blog (blog/index.html) ---------- */
.blog-hero {
  padding-block: 30px 18px;
  text-align: center;
}
.badges-row { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin-bottom: 12px; }
.blog-hero h1 {
  margin: 0 auto 10px;
  max-width: 780px;
  font-family: var(--font-display);
  font-size: clamp(1.52rem, 4.8vw, 2.38rem);
  font-weight: 800; line-height: 1.12; letter-spacing: -0.03em;
  color: var(--brand-navy);
}
.blog-hero h1 span { color: var(--brand-blue); }
.blog-hero p {
  margin: 0 auto;
  max-width: 660px;
  font-size: 0.98rem;
  color: var(--ink-secondary);
}

.blog-controls {
  max-width: 820px;
  margin: 18px auto 24px;
  display: grid;
  gap: 12px;
}
.blog-search {
  width: 100%;
  min-height: 46px;
  padding: 10px 16px;
  border-radius: 14px;
  border: 1.5px solid var(--border-strong);
  background: #FFFFFF;
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 0.94rem;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}
.blog-search:focus { outline: 2px solid var(--brand-blue); outline-offset: 1px; border-color: var(--brand-blue); }

.filter-bar {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
}
.filter-btn {
  min-height: 38px; padding: 7px 14px; border-radius: var(--radius-pill);
  border: 1.5px solid var(--border-strong); background: #FFFFFF;
  color: var(--ink-secondary); font-family: var(--font-sans); font-size: 0.82rem; font-weight: 650;
  cursor: pointer; transition: all 0.14s ease;
}
.filter-btn:hover { border-color: var(--brand-blue); color: var(--brand-blue); }
.filter-btn.is-active { background: var(--brand-navy); border-color: var(--brand-navy); color: #FFFFFF; }

.posts-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 30px;
}
@media (min-width: 700px) { .posts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1020px) { .posts-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.post-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 16px;
  text-decoration: none; color: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}
.post-card[hidden] { display: none; }
.post-card:hover { transform: translateY(-2px); border-color: var(--brand-blue); box-shadow: var(--shadow-md); }

.post-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.post-time { font-size: 0.76rem; font-weight: 600; color: var(--ink-muted); }
.post-card h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.12rem; font-weight: 700; line-height: 1.28; letter-spacing: -0.02em;
  color: var(--brand-navy);
}
.post-card p { margin: 0; font-size: 0.88rem; color: var(--ink-secondary); line-height: 1.56; }
.post-tool-tag {
  margin-top: 12px;
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.76rem; font-weight: 600; color: #047857;
  background: var(--brand-green-soft); padding: 4px 10px; border-radius: 8px;
}
.post-cta {
  display: inline-flex; align-items: center; justify-content: space-between;
  padding-top: 12px; border-top: 1px solid var(--border-subtle);
  font-size: 0.86rem; font-weight: 700; color: var(--brand-blue);
}
.post-card:hover .post-cta { color: var(--brand-navy); }

/* ---------- Página de Artigo Editorial ---------- */
.breadcrumb {
  padding-top: 18px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-size: 0.8rem; color: var(--ink-muted);
}
.breadcrumb a { color: var(--ink-secondary); text-decoration: none; font-weight: 600; }
.breadcrumb a:hover { color: var(--brand-blue); text-decoration: underline; }

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  padding-block: 14px 32px;
  align-items: start;
}
@media (min-width: 980px) {
  .article-layout { grid-template-columns: minmax(0, 1fr) 300px; gap: 30px; }
}

.article-main {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px 18px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
@media (min-width: 640px) { .article-main { padding: 34px 38px; } }

.article-header { margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid var(--border-subtle); }
.article-meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.article-title {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: clamp(1.48rem, 4.4vw, 2.15rem);
  font-weight: 800; line-height: 1.16; letter-spacing: -0.028em;
  color: var(--brand-navy);
}
.article-deck { margin: 0; font-size: 0.96rem; color: var(--ink-muted); }

/* Box de Resposta Rápida */
.quick-answer {
  margin: 0 0 22px;
  padding: 18px 20px;
  border-radius: 16px;
  background: linear-gradient(180deg, #EFF6FF 0%, #F8FBFF 100%);
  border: 1px solid #BFDBFE;
  border-left: 4px solid var(--brand-blue);
}
.quick-answer-label {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--brand-blue);
}
.quick-answer p { margin: 0 0 8px; font-size: 0.95rem; color: var(--ink-primary); line-height: 1.62; }
.quick-answer p:last-child, .quick-answer ul:last-child { margin-bottom: 0; }
.quick-answer ul { margin: 8px 0 0; padding-left: 20px; }
.quick-answer li { margin-bottom: 5px; font-size: 0.92rem; }

/* Corpo Editorial */
.article-body { font-size: 0.99rem; color: var(--ink-secondary); line-height: 1.72; }
.article-body h2 {
  margin: 30px 0 12px;
  padding-top: 6px;
  font-family: var(--font-display);
  font-size: clamp(1.22rem, 3.2vw, 1.46rem);
  font-weight: 700; line-height: 1.24; letter-spacing: -0.022em;
  color: var(--brand-navy);
  scroll-margin-top: 84px;
}
.article-body h3 {
  margin: 22px 0 8px;
  font-family: var(--font-display);
  font-size: 1.08rem; font-weight: 700; line-height: 1.3; letter-spacing: -0.015em;
  color: var(--brand-navy);
}
.article-body p { margin: 0 0 14px; }
.article-body strong { color: var(--ink-primary); font-weight: 650; }
.article-body ul, .article-body ol { margin: 0 0 16px; padding-left: 22px; }
.article-body li { margin-bottom: 8px; }
.article-body hr { border: 0; height: 1px; background: var(--border-subtle); margin: 26px 0; }
.article-body code {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.92em;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--bg-subtle);
  color: var(--brand-navy);
}
.article-body blockquote {
  margin: 18px 0;
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--brand-green-soft);
  border: 1px solid #A7F3D0;
  border-left: 4px solid var(--brand-green);
  color: #065F46;
  font-size: 0.94rem;
}
.article-body blockquote p { margin: 0; }
.article-body blockquote strong { color: #064E3B; }

/* Bloco especial "Erros comuns na obra e o que melhorar" */
.errors-callout {
  margin: 24px 0;
  padding: 20px 20px 14px;
  border-radius: 16px;
  background: #FFFBF7;
  border: 1px solid #FDE68A;
  border-left: 4px solid #D97706;
}
.errors-callout h2 {
  margin-top: 0;
  padding-top: 0;
  color: #92400E;
}
.errors-callout li { color: #334155; }

/* Tabelas responsivas */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  margin: 16px 0 20px;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  background: #FFFFFF;
}
.article-body table {
  width: 100%;
  min-width: 540px;
  border-collapse: collapse;
  font-size: 0.87rem;
  line-height: 1.48;
}
.article-body th {
  background: var(--brand-navy);
  color: #FFFFFF;
  text-align: left;
  padding: 10px 12px;
  font-weight: 650;
  font-size: 0.82rem;
}
.article-body td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--ink-secondary);
  vertical-align: top;
}
.article-body tr:last-child td { border-bottom: 0; }
.article-body tr:nth-child(even) td { background: #F8FAFC; }

/* Sidebar (TOC + Ferramenta conectada) */
.article-sidebar {
  display: grid;
  gap: 16px;
}
@media (min-width: 980px) {
  .article-sidebar { position: sticky; top: 82px; }
}
.side-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.side-title {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 0.92rem; font-weight: 700; color: var(--brand-navy);
}
.toc-list {
  list-style: none; margin: 0; padding: 0; display: grid; gap: 6px;
}
.toc-list a {
  display: block; padding: 5px 8px; border-radius: 8px;
  font-size: 0.82rem; font-weight: 550; color: var(--ink-secondary);
  text-decoration: none; line-height: 1.38;
}
.toc-list a:hover { background: var(--brand-blue-soft); color: var(--brand-blue); }

.side-tool {
  background: linear-gradient(155deg, var(--brand-navy) 0%, #123770 100%);
  color: #FFFFFF;
  border: 0;
}
.side-tool .side-title { color: #FFFFFF; font-size: 1rem; }
.side-tool p { margin: 0 0 14px; font-size: 0.84rem; color: #CBD5E1; line-height: 1.5; }
.side-tool .btn { width: 100%; white-space: normal; text-align: center; line-height: 1.25; }
.side-tool .btn + .btn { margin-top: 8px; }

/* Artigos relacionados */
.related-section {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--border-subtle);
}
.related-section h2 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 1.15rem; font-weight: 700; color: var(--brand-navy);
}
.related-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}
@media (min-width: 640px) { .related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.related-card {
  display: flex; flex-direction: column; justify-content: space-between; gap: 8px;
  padding: 15px; border-radius: 14px;
  background: #F8FAFC; border: 1px solid var(--border-subtle);
  text-decoration: none; color: inherit;
}
.related-card:hover { border-color: var(--brand-blue); background: #FFFFFF; }
.related-card strong { font-family: var(--font-display); font-size: 0.94rem; color: var(--brand-navy); line-height: 1.3; }
.related-card span { font-size: 0.8rem; font-weight: 650; color: var(--brand-blue); }

/* ---------- Banner CTA Final ---------- */
.cta-banner {
  background: linear-gradient(135deg, var(--brand-navy) 0%, #123770 100%);
  color: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 26px 22px;
  margin-bottom: 28px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 18px;
  box-shadow: var(--shadow-md);
}
.cta-banner-copy { max-width: 640px; }
.cta-eyebrow {
  margin: 0 0 6px; font-size: 0.75rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand-gold);
}
.cta-banner h2 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: clamp(1.18rem, 3.6vw, 1.52rem);
  font-weight: 700; line-height: 1.22; letter-spacing: -0.02em;
}
.cta-banner p { margin: 0; font-size: 0.9rem; color: #CBD5E1; }

/* ---------- Rodapé ---------- */
.site-footer { border-top: 1px solid var(--border-subtle); background: #FFFFFF; padding-block: 22px 28px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 12px; }
.footer-links a {
  display: inline-flex; align-items: center; min-height: 36px;
  color: var(--ink-secondary); font-size: 0.84rem; font-weight: 600; text-decoration: none;
}
.footer-links a:hover { color: var(--brand-blue); text-decoration: underline; text-underline-offset: 3px; }
.footer-private {
  margin: 0; padding: 10px 14px; border-radius: 10px;
  background: #F8FAFC; border: 1px solid var(--border-subtle);
  font-size: 0.79rem; color: var(--brand-navy); line-height: 1.55;
}

.mobile-nav-link { display: inline-flex; }
@media (min-width: 860px) { .mobile-nav-link { display: none; } }

/* DT-P1-12: evitar auto-zoom em iOS/mobile */
input:not([type="checkbox"]):not([type="radio"]), select, textarea { font-size: 16px !important; }

/* DT-360: zero sobreposição do header em telas pequenas (360px) */
@media (max-width: 479px) {
  .header-inner { gap: 6px; min-height: 58px; }
  .brand { gap: 6px; }
  .brand-mark { width: 30px; height: 30px; border-radius: 8px; }
  .brand-name { font-size: 0.86rem; }
  .brand-cat { font-size: 0.56rem; letter-spacing: 0.1em; }
  .header-actions { gap: 5px; }
  .header-actions .btn { min-height: 36px; padding: 6px 9px; font-size: 0.76rem; }
}

    @page { size: A4 portrait; margin: 10mm 12mm; }

    /* ON-PRINT-A4-STD: padronização A4 de obra (EscalaCAD) */
    @media print {
      * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
      body { background: #FFFFFF !important; color: #0F172A !important; }
      .site-header, .cta-banner, .footer-links, .result-actions, .actions-row,
      .presets-grid, .quickfix-bar, .upgrade-bar, .filter-bar, .circ-tabs,
      .hub-resolve, .no-print, .mobile-sticky-cta { display: none !important; }
      main::before {
        content: "EscalaCAD (escalacad.com) — Ficha técnica de referência · ABNT NBR 5410 · NR-10";
        display: block; font-size: 9pt; font-weight: 700; color: #071D41;
        border-bottom: 1.5pt solid #071D41; padding-bottom: 4pt; margin-bottom: 10pt;
      }
      .panel, .card, .section-card, .diag-card, .color-card, .sheet-card,
      .ref-section, .meter-card, .svg-stage, .kpi, .table-box, .din-strip,
      .err-card, .errors-callout, .quick-answer, blockquote, tr {
        break-inside: avoid !important; page-break-inside: avoid !important;
      }
      .site-footer { display: block !important; border-top: 1pt solid #CBD5E1 !important; padding-block: 8pt !important; background: #FFFFFF !important; }
      .footer-private { display: block !important; font-size: 7.5pt !important; border-color: #CBD5E1 !important; }
    }

    @media print {
      .article-sidebar, .related-section, .breadcrumb, .blog-controls { display: none !important; }
      .article-layout { display: block !important; }
    }
