/* ==========================================================================
   base.css — sistema compartilhado dos 3 blogs
   Tokens semânticos, reset, tipografia, layout, componentes e estados.
   Cada site sobrescreve apenas as variáveis de identidade em site.css.
   Referências: WCAG 2.2 AA, Web Vitals (LCP/INP/CLS), masterprompt ux/ui.
   ========================================================================== */

:root {
  /* --- identidade (sobrescrita por site.css) --- */
  --brand: #2f5d50;
  --brand-strong: #1d3d34;
  --accent: #c2683f;
  --accent-soft: #f6e9df;
  --ink: #17201d;
  --ink-2: #4a5854;
  --ink-3: #5e6a66;
  --paper: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f2f1ec;
  --line: #dedcd4;
  --line-strong: #c9c6bb;
  --success: #2f7d55;
  --warning: #a8620b;
  --danger: #a3332b;
  --info: #2c5f8a;

  /* --- tipografia --- */
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-0: clamp(0.875rem, 0.84rem + 0.15vw, 0.95rem);
  --fs-1: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  --fs-2: clamp(1.25rem, 1.16rem + 0.45vw, 1.5rem);
  --fs-3: clamp(1.6rem, 1.4rem + 1vw, 2.15rem);
  --fs-4: clamp(2.1rem, 1.7rem + 2vw, 3.35rem);
  --lh-body: 1.65;
  --lh-tight: 1.12;
  --measure: 68ch;

  /* --- espaçamento (ritmo 4/8) --- */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  --s-8: 4rem;
  --s-9: 6rem;

  /* --- forma --- */
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-1: 0 1px 2px rgb(20 30 25 / 0.06), 0 4px 16px rgb(20 30 25 / 0.05);
  --shadow-2: 0 8px 32px rgb(20 30 25 / 0.10);
  --container: 1120px;
  --container-narrow: 760px;

  /* --- movimento --- */
  --dur-fast: 140ms;
  --dur: 220ms;
  --dur-slow: 320ms;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-1);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; display: block; }
img { height: auto; }
a { color: var(--brand-strong); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
button, input, textarea, select { font: inherit; color: inherit; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute; left: var(--s-4); top: -100px; z-index: 100;
  background: var(--ink); color: #fff; padding: var(--s-3) var(--s-4);
  border-radius: var(--radius-sm); transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: var(--s-4); color: #fff; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- layout ---------- */
.container { width: min(100% - 2.5rem, var(--container)); margin-inline: auto; }
.container--narrow { width: min(100% - 2.5rem, var(--container-narrow)); margin-inline: auto; }
.section { padding-block: var(--s-8); }
.section--tight { padding-block: var(--s-6); }
.section--alt { background: var(--surface-2); }

.grid { display: grid; gap: var(--s-5); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); }
.stack > * + * { margin-top: var(--s-4); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; }

/* ---------- cabeçalho / navegação ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-4); min-height: 68px;
}
.brand {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-family: var(--font-display); font-size: var(--fs-2); font-weight: 700;
  letter-spacing: -0.02em; color: var(--ink); text-decoration: none;
}
.brand__mark { width: 26px; height: 26px; flex: none; color: var(--accent); }
.nav { display: flex; align-items: center; gap: var(--s-5); }
.nav a { color: var(--ink-2); text-decoration: none; font-size: var(--fs-0); font-weight: 600; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--accent); }
.nav-toggle {
  display: none; width: 44px; height: 44px; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--line); border-radius: var(--radius-sm);
  cursor: pointer;
}
.nav-toggle svg { width: 20px; height: 20px; }

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 44px; padding: 0.7rem 1.25rem; border-radius: var(--radius-sm);
  font-size: var(--fs-0); font-weight: 700; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: background var(--dur) var(--ease),
  transform var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-strong); color: #fff; transform: translateY(-1px); }
.btn--accent { background: var(--accent); color: #fff; }
.btn--accent:hover { filter: brightness(0.94); color: #fff; transform: translateY(-1px); }
.btn--ghost { background: transparent; color: var(--brand-strong); border-color: var(--line-strong); }
.btn--ghost:hover { border-color: var(--brand); background: var(--surface); }
.btn:active { transform: translateY(0); }

/* ---------- hero ---------- */
.hero { padding-block: var(--s-9) var(--s-7); border-bottom: 1px solid var(--line); }
.hero__eyebrow {
  display: inline-block; font-family: var(--font-mono); font-size: 0.78rem;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent);
  margin-bottom: var(--s-4);
}
.hero h1 {
  font-family: var(--font-display); font-size: var(--fs-4); line-height: var(--lh-tight);
  letter-spacing: -0.03em; max-width: 18ch; margin: 0 0 var(--s-5);
  font-weight: 700;
}
.hero p { font-size: var(--fs-2); color: var(--ink-2); max-width: 52ch; margin: 0 0 var(--s-6); }
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--s-3); }
.hero__note { font-size: 0.85rem; color: var(--ink-3); margin-top: var(--s-5); }

/* ---------- títulos e texto ---------- */
h1, h2, h3, h4 { line-height: var(--lh-tight); letter-spacing: -0.02em; color: var(--ink); }
h2 { font-family: var(--font-display); font-size: var(--fs-3); margin: 0 0 var(--s-4); }
h3 { font-size: var(--fs-2); margin: 0 0 var(--s-3); }
h4 { font-size: var(--fs-1); margin: 0 0 var(--s-2); }
p { margin: 0 0 var(--s-4); }
.lead { font-size: var(--fs-2); color: var(--ink-2); }
.muted { color: var(--ink-3); }
.eyebrow {
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent); margin-bottom: var(--s-3);
}
.section-head { max-width: 62ch; margin-bottom: var(--s-6); }
.section-head p { color: var(--ink-2); }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--s-5); box-shadow: var(--shadow-1);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--line-strong); }
.card__meta { font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; }
.card h3 { margin: var(--s-3) 0 var(--s-3); }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { color: var(--accent); }
.card p { color: var(--ink-2); font-size: var(--fs-0); margin-bottom: var(--s-4); }
.card__link { font-weight: 700; font-size: var(--fs-0); text-decoration: none; }

/* ---------- artigo ---------- */
.article { max-width: var(--container-narrow); margin-inline: auto; }
.article__header { margin-bottom: var(--s-6); }
.article__meta { display: flex; flex-wrap: wrap; gap: var(--s-3); font-size: 0.85rem; color: var(--ink-3); }
.article h1 { font-family: var(--font-display); font-size: var(--fs-4); letter-spacing: -0.03em; margin: var(--s-3) 0 var(--s-4); }
.article__body { font-size: var(--fs-1); line-height: 1.75; }
.article__body > * + * { margin-top: var(--s-4); }
.article__body h2 { margin-top: var(--s-7); font-size: var(--fs-3); }
.article__body h3 { margin-top: var(--s-5); }
.article__body ul, .article__body ol { padding-left: 1.4rem; }
.article__body li + li { margin-top: var(--s-2); }
.article__body blockquote {
  margin-inline: 0; padding: var(--s-4) var(--s-5); border-left: 4px solid var(--accent);
  background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink-2);
}
.article__body table { width: 100%; border-collapse: collapse; font-size: var(--fs-0); }
.article__body th, .article__body td { text-align: left; padding: var(--s-3); border-bottom: 1px solid var(--line); }
.article__body th { font-weight: 700; background: var(--surface-2); }
.article__toc {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--s-5); margin-bottom: var(--s-6);
}
.article__toc h2 { font-size: var(--fs-1); font-family: var(--font-body); margin-bottom: var(--s-3); }
.article__toc ol { margin: 0; padding-left: 1.2rem; }
.article__toc a { color: var(--ink-2); }
.article__footer { margin-top: var(--s-7); padding-top: var(--s-5); border-top: 1px solid var(--line); }

/* ---------- fórmulas / dados ---------- */
.data-note {
  background: var(--accent-soft); border-radius: var(--radius-sm);
  padding: var(--s-4) var(--s-5); font-size: var(--fs-0); color: var(--ink-2);
}

/* ---------- formulário ---------- */
.field { display: flex; flex-direction: column; gap: var(--s-2); margin-bottom: var(--s-4); }
.field label { font-weight: 700; font-size: var(--fs-0); }
.field input, .field textarea, .field select {
  width: 100%; min-height: 44px; padding: 0.65rem 0.8rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface);
}
.field textarea { min-height: 130px; resize: vertical; }
.field__hint { font-size: 0.82rem; color: var(--ink-3); }
.field__error { font-size: 0.85rem; font-weight: 600; color: var(--danger); margin: 0; }
[aria-invalid="true"] { border-color: var(--danger) !important; }

/* ---------- rodapé ---------- */
.site-footer { background: var(--ink); color: #e8ece9; padding-block: var(--s-7) var(--s-5); margin-top: var(--s-9); }
.site-footer a { color: #e8ece9; }
.site-footer h2 { color: #fff; font-size: var(--fs-1); }
.footer-grid { display: grid; gap: var(--s-6); grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.footer-links { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.footer-bottom { border-top: 1px solid rgb(255 255 255 / 0.16); margin-top: var(--s-6); padding-top: var(--s-4); font-size: 0.85rem; color: #b9c2bd; }

/* ---------- leitura e recursos ---------- */
.reading-progress {
  position: fixed; inset: 0 auto auto 0; height: 3px; width: 0;
  background: var(--accent); z-index: 80; pointer-events: none;
  transition: width var(--dur-fast) linear;
}
.related {
  margin-top: var(--s-7); padding: var(--s-5);
  background: var(--surface-2); border-radius: var(--radius);
}
.related h2 { font-size: var(--fs-2); margin-bottom: var(--s-3); }
.related ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.related li { border-bottom: 1px solid var(--line); padding-bottom: var(--s-2); }
.related a { font-weight: 600; text-decoration: none; }
.related a:hover { color: var(--accent); }
.author-box {
  margin-top: var(--s-6); padding: var(--s-5);
  border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--surface);
}
.author-box h2 { font-family: var(--font-body); font-size: var(--fs-1); margin-bottom: var(--s-3); }
.author-box p { font-size: var(--fs-0); color: var(--ink-2); }
.checklist { display: grid; gap: var(--s-3); padding-left: 1.3rem; }
.checklist li { padding-left: var(--s-2); }
.checklist li::marker { color: var(--accent); font-weight: 700; }

/* ---------- revelação (movimento com propósito) ---------- */
.js-enabled .reveal { opacity: 0; transform: translateY(14px); transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease); }
.js-enabled .reveal.is-visible { opacity: 1; transform: none; }

/* ---------- responsividade ---------- */
@media (max-width: 760px) {
  .nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--line);
    padding: var(--s-3) 1.25rem var(--s-5); box-shadow: var(--shadow-1);
  }
  .nav.is-open { display: flex; }
  .nav a { padding: var(--s-3) 0; border-bottom: 1px solid var(--line); }
  .nav-toggle { display: inline-flex; }
  .hero { padding-block: var(--s-7) var(--s-6); }
  .section { padding-block: var(--s-6); }
  .article__body { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important; scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}

@media print {
  .site-header, .site-footer, .nav-toggle, .hero__actions { display: none !important; }
  body { background: #fff; color: #000; }
  a { color: #000; text-decoration: underline; }
}
