/* ============================================================
   JustDoIt — global.css
   Estilos globais reutilizáveis: base de tipografia, helpers de
   layout e utilitários. Consome SEMPRE as variáveis do tokens.css.
   Importe na ordem: tokens.css → reset.css → global.css
   ============================================================ */

/* ---------- Base do documento ---------- */
body {
  font-family: var(--font-body);
  font-size: var(--font-size-md);
  color: var(--color-text);
  background-color: var(--color-surface);
  transition: background-color var(--duration-base) var(--ease-standard),
              color var(--duration-base) var(--ease-standard);
}

/* ---------- Tipografia ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: var(--weight-medium);
  line-height: var(--leading-tight);
  letter-spacing: -0.015em;
  color: var(--color-text);
  text-wrap: balance;
}
h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }

p { line-height: var(--leading-relaxed); color: var(--color-text-soft); }
p.lead { font-size: var(--font-size-lg); color: var(--color-text); }

small, .text-meta {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

a.link {
  color: var(--color-accent);
  font-weight: var(--weight-semibold);
  text-underline-offset: 2px;
}
a.link:hover { text-decoration: underline; }

/* ---------- Helpers de cor de texto ---------- */
.text-primary { color: var(--color-text); }
.text-soft    { color: var(--color-text-soft); }
.text-muted   { color: var(--color-text-muted); }
.text-faint   { color: var(--color-text-faint); }
.text-accent  { color: var(--color-accent); }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--container-wide);
  margin-inline: auto;
  padding-inline: var(--space-lg);
}

/* ---------- App page layout ---------- */
.page { padding: var(--space-xl); max-width: 980px; margin-inline: auto; }

.page__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-lg); margin-bottom: var(--space-xl); }
.page__eyebrow { font-family: var(--font-mono); font-size: var(--font-size-xs); color: var(--color-text-muted); margin-bottom: 7px; }
.page__title { font-size: var(--font-size-3xl); line-height: 1.05; }
.page__title em { font-style: italic; color: var(--color-accent); }
.page__head-actions { display: flex; align-items: center; gap: var(--space-sm); }

.section-title { font-family: var(--font-display); font-size: var(--font-size-xl); font-weight: var(--weight-medium); margin-bottom: var(--space-md); }
.section + .section { margin-top: var(--space-xl); }

@media (max-width: 880px) {
  .page { padding: var(--space-lg); }
  .page__title { font-size: var(--font-size-2xl); }
}

.stack > * + * { margin-top: var(--space-md); }   /* empilhamento vertical */
.row   { display: flex; align-items: center; gap: var(--space-md); }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.grid  { display: grid; gap: var(--space-lg); }

/* ---------- Superfícies ---------- */
.surface-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}
.surface-inverse {
  background: var(--color-inverse);
  color: var(--color-text-on-dark);
}

/* ---------- Utilitários ---------- */
.hidden { display: none !important; }
.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(--color-border); border: 0; }

/* Faixa de rolagem discreta (webkit) */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--color-border-strong);
  border-radius: var(--radius-pill);
  border: 2px solid var(--color-surface);
}
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- Modo embed (iframe) ---------- */
html.is-embed aside[data-sidebar] { display: none !important; }
html.is-embed .app__main { width: 100%; }

/* ---------- Responsivo ---------- */
@media (max-width: 768px) {
  .container { padding-inline: var(--space-md); }
  h1 { font-size: var(--font-size-2xl); }
  h2 { font-size: var(--font-size-xl); }
  .grid { gap: var(--space-md); }
}
