/* ============================================================
   GLEIDSON ANDRADE — DESIGN SYSTEM (Component Library) v1.0
   Consome tokens.css. Componentes base para landing + blog (SSG).
   Depende de: tokens.css (mesmo pipeline).
   ============================================================ */

/* ---------- Base / reset leve ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video { max-width: 100%; display: block; }
a { color: var(--text-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Foco visível (WCAG 2.4.7 / 2.4.11 AA) ----------
   Anel consistente em qualquer elemento interativo acionado por teclado.
   Cor azure-500: contraste ≥3:1 sobre fundos claros e escuros. */
:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--radius-xs);
}
/* Não remova o foco no modo mouse sem substituto: mantemos o anel só no teclado.
   Fallback para navegadores sem :focus-visible. */
a:focus, button:focus, [tabindex]:focus, summary:focus {
  outline: var(--focus-ring-width) solid var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
}
a:focus:not(:focus-visible), button:focus:not(:focus-visible),
[tabindex]:focus:not(:focus-visible), summary:focus:not(:focus-visible) {
  outline: none;
}

/* ---------- Tipografia utilitária ---------- */
.display, h1, h2, h3 { font-family: var(--font-display); letter-spacing: var(--tracking-tight); }
h1, .h1 { font-size: var(--fs-4xl); line-height: var(--lh-tight); font-weight: var(--fw-extrabold); margin: 0 0 var(--space-4); }
h2, .h2 { font-size: var(--fs-3xl); line-height: var(--lh-tight); font-weight: var(--fw-bold); margin: 0 0 var(--space-4); }
h3, .h3 { font-size: var(--fs-2xl); line-height: var(--lh-snug); font-weight: var(--fw-bold); margin: 0 0 var(--space-3); }
h4, .h4 { font-size: var(--fs-xl); line-height: var(--lh-snug); font-weight: var(--fw-semibold); margin: 0 0 var(--space-3); font-family: var(--font-display); }
.lead { font-size: var(--fs-md); line-height: var(--lh-relaxed); color: var(--text-secondary); }
.eyebrow {
  font-size: var(--fs-sm); font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-caps); text-transform: uppercase;
  color: var(--text-accent);
}
.muted { color: var(--text-muted); }
.mono { font-family: var(--font-mono); }
.text-gradient {
  background: var(--gradient-signal);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- Layout: container / grid ---------- */
.container { width: 100%; max-width: var(--container-max); margin-inline: auto; padding-inline: var(--space-5); }
.container--narrow { max-width: var(--container-narrow); }
.section { padding-block: var(--section-y); }
.grid { display: grid; gap: var(--grid-gutter); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.stack > * + * { margin-top: var(--space-4); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  h1, .h1 { font-size: var(--fs-3xl); }
  h2, .h2 { font-size: var(--fs-2xl); }
}

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: var(--fs-base);
  line-height: 1; padding: 0.85em 1.5em; border-radius: var(--radius-pill);
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out),
              background var(--dur-base) var(--ease-out);
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring); outline-offset: var(--focus-ring-offset); }
.btn--primary { background: var(--color-azure-600); color: var(--color-white); box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--color-azure-700); box-shadow: var(--shadow-glow); }
.btn--gradient { background: var(--gradient-signal); color: var(--color-white); box-shadow: var(--shadow-sm); }
.btn--gradient:hover { box-shadow: var(--shadow-glow); }
.btn--secondary { background: transparent; color: var(--text-primary); border-color: var(--border-strong); }
.btn--secondary:hover { border-color: var(--color-azure-500); color: var(--text-accent); }
/* Variante de contorno para uso sobre fundo escuro (heros ink/gradiente).
   Substitui os overrides inline color:#fff;border-color:rgba(255,255,255,.35). */
.btn--secondary-inverse { background: transparent; color: var(--color-white); border-color: rgba(255,255,255,0.35); }
.btn--secondary-inverse:hover { border-color: var(--color-white); color: var(--color-white); background: rgba(255,255,255,0.08); }
.btn--ghost { background: transparent; color: var(--text-accent); }
.btn--ghost:hover { background: var(--color-gray-100); }
.btn--gold { background: var(--color-gold-500); color: var(--color-ink-900); }
.btn--gold:hover { background: var(--color-gold-600); }
.btn--sm { font-size: var(--fs-sm); padding: 0.6em 1.1em; }
.btn--lg { font-size: var(--fs-md); padding: 1em 1.9em; }
.btn[disabled], .btn--disabled { opacity: 0.5; pointer-events: none; }

/* ---------- Cards ---------- */
.card {
  background: var(--bg-elevated); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); padding: var(--space-6);
  box-shadow: var(--shadow-xs); transition: box-shadow var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
.card--interactive:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
/* GLE-992: card inteiro clicável (stretched-link) — mantém links/botões internos clicáveis por cima */
.card--interactive { position: relative; }
.card--interactive .card__stretch::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.card--interactive .card__stretch { outline: none; }
.card--interactive .card__stretch:focus-visible::after { outline: 2px solid var(--color-azure-600); outline-offset: 3px; }
.card--interactive a:not(.card__stretch), .card--interactive button { position: relative; z-index: 2; }
.card__eyebrow { margin-bottom: var(--space-2); }
.card__title { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: var(--fw-bold); margin: 0 0 var(--space-2); }
.card__body { color: var(--text-secondary); margin: 0; }
.card--feature { border-top: 3px solid var(--color-azure-600); }
.card--dark { background: var(--gradient-brand); color: var(--text-inverse); border: none; }
.card--dark .card__body { color: var(--color-gray-200); }

/* Métrica / prova social */
.stat { }
.stat__value { font-family: var(--font-display); font-size: var(--fs-3xl); font-weight: var(--fw-extrabold); line-height: 1; color: var(--text-accent); }
.stat__label { font-size: var(--fs-sm); color: var(--text-muted); margin-top: var(--space-2); }

/* ---------- Navbar ---------- */
.nav {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-5);
  padding-block: var(--space-4); position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg-page) 82%, transparent);
  backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}
.nav__brand { display: flex; align-items: center; gap: var(--space-3); font-family: var(--font-display); font-weight: var(--fw-bold); font-size: var(--fs-md); color: var(--text-primary); }
.nav__logo { width: 34px; height: 34px; display: grid; place-items: center; }
.nav__logo svg { display: block; width: 34px; height: 34px; }
.nav__links { display: flex; gap: var(--space-5); list-style: none; margin: 0; padding: 0; }
.nav__links a { color: var(--text-secondary); font-weight: var(--fw-medium); font-size: var(--fs-sm); }
.nav__links a:hover { color: var(--text-accent); text-decoration: none; }
@media (max-width: 768px) { .nav__links { display: none; } }

/* ---------- Mobile nav (hamburger) — GLE-950 ---------- */
.nav__toggle { display: none; }
@media (max-width: 768px) {
  .nav__toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; padding: 0;
    background: transparent; border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md); color: var(--text-primary); cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .nav__toggle:hover { border-color: var(--border-strong); }
  .nav__toggle-bars { display: block; width: 20px; height: 14px; position: relative; }
  .nav__toggle-bars span {
    position: absolute; left: 0; width: 100%; height: 2px; border-radius: 2px;
    background: currentColor; transition: transform .2s ease, opacity .2s ease, top .2s ease;
  }
  .nav__toggle-bars span:nth-child(1) { top: 0; }
  .nav__toggle-bars span:nth-child(2) { top: 6px; }
  .nav__toggle-bars span:nth-child(3) { top: 12px; }
  .nav--open .nav__toggle-bars span:nth-child(1) { top: 6px; transform: rotate(45deg); }
  .nav--open .nav__toggle-bars span:nth-child(2) { opacity: 0; }
  .nav--open .nav__toggle-bars span:nth-child(3) { top: 6px; transform: rotate(-45deg); }

  .nav .nav__actions { display: none; }

  .nav__mobile {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-lg);
    padding: var(--space-3) var(--space-5) var(--space-6);
    display: flex; flex-direction: column; gap: var(--space-3);
    max-height: calc(100vh - 100%); overflow-y: auto;
  }
  .nav__mobile[hidden] { display: none; }
  .nav__mobile-links { list-style: none; margin: 0; padding: 0; }
  .nav__mobile-links a {
    display: block; padding: var(--space-3) var(--space-1);
    color: var(--text-primary); font-weight: var(--fw-medium); font-size: var(--fs-md);
    border-bottom: 1px solid var(--border-subtle);
  }
  .nav__mobile-links li:last-child a { border-bottom: 0; }
  .nav__mobile-links a:hover { color: var(--text-accent); text-decoration: none; }
  .nav__mobile-links a[aria-current="page"] { color: var(--text-accent); }
  .nav__mobile-actions { display: flex; flex-direction: column; gap: var(--space-3); margin-top: var(--space-3); }
  .nav__mobile-actions .btn { width: 100%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .nav__toggle-bars span { transition: none; }
}

/* ---------- Footer ---------- */
.footer { background: var(--color-ink-900); color: var(--color-gray-300); padding-block: var(--space-8) var(--space-6); }
.footer a { color: var(--color-gray-200); }
.footer a:hover { color: var(--color-white); }
.footer__grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: var(--space-6); }
.footer__brand { font-family: var(--font-display); font-weight: var(--fw-bold); font-size: var(--fs-lg); color: #fff; }
.footer__title { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--color-gray-400); margin-bottom: var(--space-3); }
.footer__bottom { border-top: 1px solid rgba(255,255,255,0.10); margin-top: var(--space-6); padding-top: var(--space-4); font-size: var(--fs-sm); color: var(--color-gray-400); display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--space-3); }
@media (max-width: 768px) { .footer__grid { grid-template-columns: 1fr; } }

/* ---------- Formulário ---------- */
.form { display: grid; gap: var(--space-4); }
.form[hidden] { display: none; } /* GLE-144: [hidden] sozinho não vence .form{display:grid} */
.field { display: grid; gap: var(--space-2); }
.field__label { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-primary); }
.field__hint { font-size: var(--fs-xs); color: var(--text-muted); }
.input, .textarea, .select {
  width: 100%; font-family: var(--font-body); font-size: var(--fs-base); color: var(--text-primary);
  background: var(--bg-page); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 0.75em 0.9em; transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.textarea { min-height: 120px; resize: vertical; }
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--color-azure-500);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus-ring) 30%, transparent);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.field--error .input, .field--error .textarea { border-color: var(--color-danger); }
.field__error { font-size: var(--fs-xs); color: var(--color-danger); }

/* ---------- Badge / pill ---------- */
.badge {
  display: inline-flex; align-items: center; gap: var(--space-1);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-wide);
  padding: 0.35em 0.75em; border-radius: var(--radius-pill);
  background: var(--color-gray-100); color: var(--text-secondary);
}
.badge--accent { background: color-mix(in srgb, var(--color-azure-500) 14%, transparent); color: var(--color-azure-700); }
.badge--gold { background: color-mix(in srgb, var(--color-gold-500) 20%, transparent); color: var(--color-gold-700); }

/* ---------- Chip (tag / filtro selecionável) ----------
   Pílula interativa para filtros, tags e seletores (ex.: /diagnostico).
   Origem: dg-chip (GLE-989), promovido ao DS compartilhado em GLE-1001.
   Estado selecionado via [aria-pressed="true"] (toggle), [aria-checked="true"]
   (radio, ex.: /diagnostico role=radio) ou .chip--active. */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-family: var(--font-body); font-size: var(--fs-sm); font-weight: var(--fw-medium);
  color: var(--text-secondary); background: var(--bg-subtle);
  border: 1px solid var(--border-strong); border-radius: var(--radius-pill);
  padding: var(--space-2) var(--space-4); cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.chip:hover { border-color: var(--color-azure-500); color: var(--text-accent); }
.chip[aria-pressed="true"], .chip[aria-checked="true"], .chip--active {
  color: var(--color-white); background: var(--color-azure-600); border-color: var(--color-azure-600);
}
.chip[disabled], .chip--disabled { opacity: 0.5; pointer-events: none; }

/* ---------- Utilidades ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.divider { height: 1px; background: var(--border-subtle); border: 0; margin-block: var(--space-6); }
