/* Frances Contabilidade & Contarg — Design System Mobile-First para Blog & Guias */

:root {
  color-scheme: light;
  --navy: #061B35;
  --navy-mid: #0F294A;
  --green: #067A46;
  --green-hover: #045932;
  --green-mint: #53E49E;
  --green-soft: #E8FAF1;
  --bg: #F8FCFA;
  --surface: #FFFFFF;
  --ink: #061B35;
  --text: #334155;
  --muted: #64748B;
  --line: #E0EEE7;
  --shadow-sm: 0 4px 14px rgba(6, 27, 53, 0.04);
  --shadow-md: 0 14px 35px rgba(6, 27, 53, 0.07);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16.5px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4 {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.025em;
}

a, button { touch-action: manipulation; }

a {
  color: var(--green);
  text-underline-offset: 0.2em;
  transition: color 0.15s ease;
}
a:hover { color: var(--green-hover); }

.skip {
  position: absolute;
  top: -120px;
  left: 16px;
}
.skip:focus {
  top: 12px;
  background: var(--navy);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  z-index: 50;
}

:focus-visible {
  outline: 3px solid #FFAD1F;
  outline-offset: 3px;
}

/* Header Sticky */
header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px;
}

header nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 900;
  text-decoration: none;
  color: var(--navy);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.brand::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 4px;
  background: var(--green);
  display: inline-block;
}

header nav a:not(.brand) {
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text);
  padding: 8px 12px;
  border-radius: 10px;
  transition: background 0.15s, color 0.15s;
}
header nav a:not(.brand):hover {
  background: var(--green-soft);
  color: var(--green);
}
header nav a:last-child {
  background: var(--green);
  color: #FFFFFF !important;
  font-weight: 800;
  padding: 9px 16px;
  box-shadow: 0 6px 16px rgba(6, 122, 70, 0.22);
}
header nav a:last-child:hover {
  background: var(--green-hover);
  transform: translateY(-1px);
}

/* Main container: Artigos vs Índice */
main {
  max-width: 880px;
  margin: 36px auto 56px;
  background: var(--surface);
  padding: 44px 48px;
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow-md);
}

body.blog-index main {
  max-width: 1200px;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0 24px;
  margin-top: 28px;
}

/* Hero do Índice do Blog */
.blog-hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 65%, #123B70 100%);
  color: #FFFFFF;
  border-radius: 26px;
  padding: 48px 44px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(6, 27, 53, 0.16);
}
.blog-hero .tag {
  background: rgba(83, 228, 158, 0.16);
  color: var(--green-mint);
  border: 1px solid rgba(83, 228, 158, 0.35);
  margin-bottom: 14px;
}
.blog-hero h1 {
  color: #FFFFFF;
  font-size: clamp(2rem, 4.5vw, 3.1rem);
  line-height: 1.08;
  margin: 0 0 14px;
  max-width: 780px;
}
.blog-hero p {
  color: #CBD5E1;
  font-size: 1.05rem;
  max-width: 680px;
  margin: 0;
}

/* Tipografia Geral */
h1 {
  font-size: clamp(1.9rem, 4.5vw, 2.75rem);
  line-height: 1.12;
  margin: 14px 0 20px;
}
h2 {
  font-size: 1.45rem;
  line-height: 1.28;
  margin-top: 38px;
}
h3 { font-size: 1.12rem; line-height: 1.4; }

.lead {
  font-size: 1.12rem;
  color: var(--text);
  line-height: 1.75;
}

.meta, .crumbs, .sources {
  font-size: 0.88rem;
  color: var(--muted);
}
.crumbs a { text-decoration: none; font-weight: 700; }

.tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 10px;
}

/* Filtros do Índice */
.filters {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  background: var(--surface);
  padding: 20px 24px;
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
}

label {
  display: block;
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input, select {
  padding: 12px 14px;
  min-height: 46px;
  width: 100%;
  border: 1px solid #CBD5E1;
  border-radius: 10px;
  font: inherit;
  font-size: 16px;
  color: var(--navy);
  background: #F8FAFC;
  transition: border-color 0.15s, background 0.15s;
}
input:focus, select:focus {
  background: #FFFFFF;
  border-color: var(--green);
  outline: none;
}

#contagem {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--green);
  margin: 0 0 18px 4px;
}

/* Grid de Cards do Índice */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--green);
  box-shadow: 0 18px 36px rgba(6, 27, 53, 0.09);
}
.card h2 {
  margin: 6px 0 10px;
  font-size: 1.15rem;
  line-height: 1.32;
}
.card h2 a {
  color: var(--navy);
  text-decoration: none;
}
.card h2 a:hover {
  color: var(--green);
}
.card p {
  font-size: 0.9rem;
  color: var(--text);
  margin: 0;
  line-height: 1.55;
}
.card p.tag {
  margin-bottom: 8px;
  font-size: 0.7rem;
  width: fit-content;
}

/* Blocos Internos dos Artigos */
.toc, .example, .cta, .calculator {
  padding: 24px 26px;
  background: var(--green-soft);
  border: 1px solid #C6ECD8;
  border-radius: 16px;
  margin: 28px 0;
}
.toc h2, .example h2, .cta h2, .calculator h2 { margin-top: 0; }
.toc ol { margin-bottom: 0; padding-left: 20px; }
.toc li { margin: 6px 0; font-size: 0.94rem; font-weight: 600; }

.cta {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  border-color: var(--navy);
  color: #FFFFFF;
}
.cta h2 { color: #FFFFFF; }
.cta p { color: #CBD5E1; }

.checklist { padding-left: 22px; }
.checklist li { margin: 0.5em 0; }
.sources li { overflow-wrap: anywhere; margin: 10px 0; }

.related {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.related a {
  display: block;
  margin: 10px 0;
  font-weight: 700;
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
}
.related a:hover {
  border-color: var(--green);
  background: var(--green-soft);
}

.button, button {
  display: inline-block;
  border: 0;
  border-radius: 12px;
  background: var(--green);
  color: #FFFFFF !important;
  padding: 12px 20px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(6, 122, 70, 0.25);
  transition: background 0.15s, transform 0.15s;
}
.cta .button {
  background: var(--green-mint);
  color: var(--navy) !important;
}
.button:hover, button:hover {
  background: var(--green-hover);
  transform: translateY(-1px);
}
.cta .button:hover {
  background: #3FD68C;
}

output {
  display: block;
  margin: 15px 0 0;
  padding: 12px 14px;
  background: #FFFFFF;
  border-radius: 10px;
  border: 1px solid #C6ECD8;
  font-weight: 800;
  color: var(--navy);
}

.note { font-size: 0.86rem; color: var(--muted); }

section { scroll-margin-top: 84px; }
details {
  border-top: 1px solid var(--line);
  padding: 16px 0;
}
summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--navy);
}

/* Footer Escuro Institucional */
footer {
  background: var(--navy);
  color: #CBD5E1;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 56px;
}
footer .wrap {
  padding-top: 36px;
  padding-bottom: 36px;
}
footer p { margin: 8px 0; font-size: 0.88rem; }
footer strong { color: #FFFFFF; }
footer a {
  color: var(--green-mint);
  font-weight: 700;
  text-decoration: none;
}
footer a:hover { text-decoration: underline; }
footer .note {
  color: #94A3B8;
  font-size: 0.78rem;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

@media (max-width: 768px) {
  body { font-size: 16px; }
  header nav { gap: 8px; }
  header nav .brand { width: 100%; justify-content: flex-start; margin-bottom: 2px; }
  header nav a:not(.brand) { font-size: 0.8rem; padding: 8px 10px; min-height: 40px; display: inline-flex; align-items: center; }
  main { margin: 14px; padding: 24px 18px; border-radius: 18px; }
  body.blog-index main { padding: 0 14px; margin-top: 16px; }
  .blog-hero { padding: 28px 20px; border-radius: 20px; margin-bottom: 18px; }
  .wrap { padding: 12px 14px; }
  .filters { grid-template-columns: 1fr; padding: 16px; }
  .grid { grid-template-columns: 1fr; }
  .button, button { width: 100%; text-align: center; min-height: 48px; }
}

@media print {
  header, .toc, .cta, .calculator, .related, footer { display: none; }
  body { background: white; }
  main { border: 0; margin: 0; padding: 0; max-width: none; box-shadow: none; }
  h1 { font-size: 26pt; }
  h2 { break-after: avoid; }
  a { color: inherit; }
}
