/* ==========================================================================
   MY FIRST CROCHET — BASE
   Reset moderno + tipografia + layout primitives.
   Depende de tokens.css. Não contém nenhum HEX literal.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. RESET
   -------------------------------------------------------------------------- */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text-primary);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

input, button, textarea, select { font: inherit; color: inherit; }

p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }

ul[class], ol[class] { list-style: none; padding: 0; }

a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}

::selection {
  background: var(--accent-soft);
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   2. TIPOGRAFIA
   -------------------------------------------------------------------------- */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-heading);
  color: var(--text-primary);
  /* opsz alto = formas mais elegantes e contrastadas, próprias de título */
  font-variation-settings: "opsz" 84;
}

h1 { font-size: var(--fs-h1); line-height: var(--lh-tight); letter-spacing: var(--ls-display); font-variation-settings: "opsz" 120; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }

.display {
  font-family: var(--font-display);
  font-size: var(--fs-display);
  font-weight: var(--fw-display);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-display);
  font-variation-settings: "opsz" 144;
}

.lead {
  font-size: var(--fs-lead);
  line-height: var(--lh-snug);
  color: var(--text-secondary);
}

.eyebrow {
  font-family: var(--font-body);
  font-size: var(--fs-eyebrow);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--accent-strong);
}

.small  { font-size: var(--fs-small); }
.tiny   { font-size: var(--fs-tiny); }
.muted  { color: var(--text-secondary); }
.faint  { color: var(--text-muted); }

.serif  { font-family: var(--font-display); }
.italic { font-style: italic; }

/* Texto que precisa respirar como leitura longa */
.prose > * + * { margin-top: var(--space-5); }
.prose h2 { margin-top: var(--space-10); }
.prose h3 { margin-top: var(--space-8); }
.prose strong { font-weight: var(--fw-semibold); color: var(--text-primary); }
.prose em { font-style: italic; }

/* --------------------------------------------------------------------------
   3. LAYOUT
   -------------------------------------------------------------------------- */

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

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

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

.section          { padding-block: var(--section-y); }
.section-tight    { padding-block: var(--section-y-tight); }
.section-alt      { background: var(--background-alt); }
.section-deep     { background: var(--background-deep); }
.section-inverse  { background: var(--surface-inverse); color: var(--text-inverse); }
.section-inverse h1,
.section-inverse h2,
.section-inverse h3,
.section-inverse h4 { color: var(--text-inverse); }
.section-inverse .muted { color: var(--text-inverse-soft); }

/* Cabeçalho de seção — padrão do ecossistema */
.section-head {
  text-align: center;
  max-width: 46rem;
  margin-inline: auto;
  margin-bottom: var(--space-12);
}
.section-head .eyebrow { display: block; margin-bottom: var(--space-3); }
.section-head p { margin-top: var(--space-4); }

/* Grids */
.grid { display: grid; gap: var(--space-6); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); }

/* Flex helpers */
.row     { display: flex; align-items: center; gap: var(--space-3); }
.row-wrap{ display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.center  { text-align: center; }
.stack > * + * { margin-top: var(--space-4); }

/* --------------------------------------------------------------------------
   4. REVEAL ON SCROLL
   ⚠️ REGRA DE OURO: isto é enfeite. O conteúdo NUNCA pode depender dele.

   Por isso o estado escondido só existe sob `html.js`, classe que o próprio
   JS adiciona no <head> antes da primeira pintura. Se o JavaScript não rodar,
   se o IntersectionObserver não disparar, se uma extensão atrapalhar — a
   página aparece inteira, normalmente.

   Isso não é hipotético: numa página de vendas em produção o observer não
   disparou, e a página ficou com 30 blocos em opacity 0. Um enfeite não pode
   derrubar a venda.
   -------------------------------------------------------------------------- */

.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--dur-slow) var(--ease-out),
              transform var(--dur-slow) var(--ease-out);
  will-change: opacity, transform;
}
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* --------------------------------------------------------------------------
   5. UTILITÁRIOS
   -------------------------------------------------------------------------- */

.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;
}

.hide-mobile { }
.hide-desktop { display: none; }

@media (max-width: 48rem) {
  .hide-mobile  { display: none !important; }
  .hide-desktop { display: revert; }
}

.no-scroll { overflow: hidden; }
