/* =============================================================
   BASE. tipografia Raleway, layout container, utilidades
   essenciais e classes tipográficas usadas em todas as páginas.
   ============================================================= */

/* -----------------------------------------------------------
   1. RALEWAY (variable font local. 1 arquivo, todos os pesos)
   ----------------------------------------------------------- */

@font-face {
  font-family: 'Raleway';
  src: url('../assets/fonts/Raleway-Variable.woff2') format('woff2-variations'),
       url('../assets/fonts/Raleway-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* -----------------------------------------------------------
   2. BODY GLOBAL
   ----------------------------------------------------------- */

html {
  font-size: 100%; /* respeita preferência do usuário (1rem = 16px default) */
}

body {
  font-family: var(--font-sans);
  font-weight: var(--fw-regular);
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  font-feature-settings: 'kern' 1, 'liga' 1;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* -----------------------------------------------------------
   3. HIERARQUIA TIPOGRÁFICA
   ----------------------------------------------------------- */

.display {
  font-size: var(--fs-display);
  font-weight: var(--fw-light);
  line-height: var(--lh-display);
  letter-spacing: var(--ls-tight);
}

.display-xl {
  font-size: var(--fs-display-xl);
  font-weight: var(--fw-light);
  line-height: var(--lh-display);
  letter-spacing: var(--ls-tight);
}

.h1 {
  font-size: var(--fs-h1);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
}

.h2 {
  font-size: var(--fs-h2);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
}

.h3 {
  font-size: var(--fs-h3);
  font-weight: var(--fw-medium);
  line-height: var(--lh-snug);
}

.body-lg {
  font-size: var(--fs-body-lg);
  line-height: var(--lh-relaxed);
}

.body {
  font-size: var(--fs-body);
  line-height: var(--lh-relaxed);
}

.caption {
  font-size: var(--fs-caption);
  line-height: var(--lh-normal);
  color: var(--text-muted);
}

/* Eyebrow. pequena, uppercase, espaçada, geralmente em laranja
   Usada como rótulo de seção ou contador (ex: "SISTEMA 01 / 05") */
.eyebrow {
  display: inline-block;
  font-size: var(--fs-eyebrow);
  font-weight: var(--fw-medium);
  line-height: 1;
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--text-brand);
}

/* Frase-âncora. destaque tipográfico para frases manifesto
   Usada em quebras de seção e Hero secundário */
.anchor-phrase {
  font-size: var(--fs-h1);
  font-weight: var(--fw-light);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  color: var(--text-primary);
}

.anchor-phrase strong {
  font-weight: var(--fw-semibold);
  color: var(--text-brand);
}

/* Pequena tag de destaque para palavras-chave no meio do texto
   Ex: "Pipeline imprevisível [custa caro]". no laranja, leve box */
.highlight-orange {
  background: var(--action-primary);
  color: var(--action-primary-text);
  padding: 0.05em 0.35em;
  border-radius: var(--radius-xs);
  font-weight: var(--fw-semibold);
}

/* -----------------------------------------------------------
   4. UTILIDADES DE TEXTO
   ----------------------------------------------------------- */

.text-brand    { color: var(--text-brand); }
.text-primary  { color: var(--text-primary); }
.text-secondary{ color: var(--text-secondary); }
.text-muted    { color: var(--text-muted); }
.text-inverse  { color: var(--text-inverse); }

.text-center { text-align: center; }
.text-left   { text-align: left; }

.text-balance { text-wrap: balance; }
.text-pretty  { text-wrap: pretty; }

/* Aplicar wrap balance em todos os headings por padrão (melhora leitura) */
.h1, .h2, .h3, .display, .display-xl, .anchor-phrase {
  text-wrap: balance;
}

/* -----------------------------------------------------------
   5. CONTAINER (limita largura, padding lateral fluido)
   ----------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-px);
}

.container-narrow {
  width: 100%;
  max-width: 840px;
  margin-inline: auto;
  padding-inline: var(--container-px);
}

.container-wide {
  width: 100%;
  max-width: 1440px;
  margin-inline: auto;
  padding-inline: var(--container-px);
}

/* -----------------------------------------------------------
   6. SEÇÕES. espaçamento vertical consistente entre blocos
   ----------------------------------------------------------- */

.section {
  padding-block: var(--section-py);
}

.section-sm {
  padding-block: var(--section-py-sm);
}

/* Variantes de fundo de seção */
.section--dark    { background: var(--bg-primary);   color: var(--text-primary); }
.section--darker  { background: var(--bg-secondary); color: var(--text-primary); }
.section--light   { background: var(--bg-inverse);   color: var(--text-inverse); }
.section--light-soft { background: var(--bg-inverse-soft); color: var(--text-inverse); }

/* Quando uma seção for light, ajustar tokens de texto secundário */
.section--light .text-secondary,
.section--light-soft .text-secondary {
  color: var(--text-inverse-soft);
}

.section--light .text-muted,
.section--light-soft .text-muted {
  color: var(--color-cinza-500);
}

/* Seção com degradê tecnológico como background (use com moderação) */
.section--gradient-tech {
  background: var(--gradient-tech);
  color: var(--color-preto);
}

/* -----------------------------------------------------------
   7. GRID / FLEX HELPERS
   ----------------------------------------------------------- */

.grid {
  display: grid;
  gap: var(--space-md);
}

.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 769px) and (max-width: 1023px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.flex {
  display: flex;
}

.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }

.gap-xs   { gap: var(--space-xs); }
.gap-sm   { gap: var(--space-sm); }
.gap-md   { gap: var(--space-md); }
.gap-lg   { gap: var(--space-lg); }
.gap-xl   { gap: var(--space-xl); }

/* -----------------------------------------------------------
   8. STACK (vertical rhythm utility)
   Aplica margin-top entre filhos diretos.
   Uso: <div class="stack stack-md">...</div>
   ----------------------------------------------------------- */

[class*="stack"] > * + * {
  margin-top: var(--stack-gap, var(--space-md));
}

.stack-xs > * + * { --stack-gap: var(--space-xs); }
.stack-sm > * + * { --stack-gap: var(--space-sm); }
.stack-md > * + * { --stack-gap: var(--space-md); }
.stack-lg > * + * { --stack-gap: var(--space-lg); }
.stack-xl > * + * { --stack-gap: var(--space-xl); }
.stack-2xl > * + * { --stack-gap: var(--space-2xl); }

/* -----------------------------------------------------------
   9. SELEÇÃO DE TEXTO COM A COR DA MARCA
   ----------------------------------------------------------- */

::selection {
  background: var(--color-laranja-400);
  color: var(--color-branco);
}

/* -----------------------------------------------------------
   10. SCROLLBAR CUSTOMIZADO (Webkit, mantém padrão em Firefox)
   ----------------------------------------------------------- */

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--color-cinza-700);
}
::-webkit-scrollbar-thumb {
  background: var(--color-cinza-600);
  border-radius: var(--radius-pill);
  border: 2px solid var(--color-cinza-700);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-laranja-400);
}

/* -----------------------------------------------------------
   11. CLASSE PARA REVEAL ON SCROLL (controlada por JS)
   ----------------------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity var(--motion-slower) var(--ease-out),
    transform var(--motion-slower) var(--ease-out);
  will-change: opacity, transform;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger: se vários elementos compartilharem o mesmo .reveal-group,
   o JS pode aplicar delay incremental. */
.reveal[data-delay="100"] { transition-delay: 100ms; }
.reveal[data-delay="200"] { transition-delay: 200ms; }
.reveal[data-delay="300"] { transition-delay: 300ms; }
.reveal[data-delay="400"] { transition-delay: 400ms; }
.reveal[data-delay="500"] { transition-delay: 500ms; }
