/* ============================================
   BASE.CSS — tokens, reset e tipografia
   Studio Thaisa Vieira
   Os pares de cor usados de fato são medidos por
   scripts/check-contrast.mjs, que lê este arquivo.
============================================ */

/* ---------- Fontes locais (ver assets/fonts/README.md) ---------- */

@font-face {
  font-family: 'Literata';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url('../fonts/literata-latin-var.woff2') format('woff2');
}

@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('../fonts/source-sans-3-latin-var.woff2') format('woff2');
}

:root {
  /* Cor */
  --color-white:        #FFFFFF;
  --color-surface:      #F2ECF5;
  --color-ink:          #262229;
  --color-ink-muted:    #615B64;
  --color-plum:         #613C67;
  --color-plum-deep:    #48294E;
  --color-line:         #DDD3E0;
  --color-stage:        #24152E;
  --color-stage-muted:  #DDD3E0;
  --color-stage-link:   #F1E8F7;
  --color-choice-hover: #E8DDED;
  --color-reach:        #E9DEED;

  --color-bg:           var(--color-white);
  --color-text:         var(--color-ink);
  --color-text-muted:   var(--color-ink-muted);
  --color-action:       var(--color-plum);
  --color-action-hover: var(--color-plum-deep);
  --color-on-action:    var(--color-white);
  --color-focus:        var(--color-plum);

  /* Tipografia: duas famílias, poucos pesos */
  --font-serif: 'Literata', Georgia, 'Times New Roman', serif;
  --font-sans:  'Source Sans 3', 'Segoe UI', system-ui, -apple-system, sans-serif;

  --text-sm:   0.9375rem;                                  /* 15px — só metadados curtos */
  --text-base: 1.0625rem;                                  /* 17px — corpo */
  --text-lg:   clamp(1.125rem, 1.07rem + 0.25vw, 1.25rem); /* apoio */
  --text-h3:   clamp(1.25rem, 1.17rem + 0.35vw, 1.4375rem);
  --text-h2:   clamp(1.75rem, 1.48rem + 1.15vw, 2.5rem);
  --text-h1:   clamp(2.375rem, 1.6rem + 3.3vw, 4.25rem);

  --leading-body:  1.6;
  --leading-tight: 1.12;

  /* Espaço */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --section-y: clamp(2.75rem, 1.8rem + 4vw, 5.5rem);

  /* Forma */
  --container:   1240px;
  --gutter:      clamp(1rem, 0.6rem + 1.8vw, 2rem);
  --measure:     36rem;
  --radius:      6px;
  --header-h:    5.5rem;

  /* Movimento: uma só curva — início decidido, desaceleração longa,
     parada precisa — e quatro tempos. Todo movimento não essencial fica
     sob prefers-reduced-motion: no-preference. */
  --ease-settle:  cubic-bezier(0.22, 1, 0.36, 1);
  --dur-press:    140ms;  /* links e botões */
  --dur-menu:     180ms;  /* painel e ícone do menu */
  --dur-page:     220ms;  /* passagem entre páginas */
  --dur-opening:  620ms;  /* gesto da foto de abertura da home */
}

/* ---------- Reset ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + var(--space-4));
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* ---------- Passagem entre páginas ----------
   Transição nativa entre documentos, como melhoria progressiva: todas as
   páginas carregam este arquivo, então origem e destino fazem o opt-in.
   Só a dissolução do conteúdo, curta; nada desliza. O cabeçalho é igual
   em todas as páginas e fica no mesmo lugar, então a dissolução (old e
   new com o mesmo tempo e curva) não o altera. Sem suporte, ou com
   movimento reduzido, a navegação é a comum. */

@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }

  /* O grupo também, para que a passagem toda dure o mesmo tempo: enquanto
     ela corre, a página não recebe cliques. */
  ::view-transition-group(root),
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: var(--dur-page);
    animation-timing-function: var(--ease-settle);
  }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: anywhere;
}

h1, h2, h3, p, ul, ol, dl, dd, figure, blockquote {
  margin: 0;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
  padding: 0;
}

img,
picture,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

/* Resposta curta de cor e sublinhado; o anel de foco não transiciona. */
a {
  color: inherit;
  transition:
    color var(--dur-press) var(--ease-settle),
    text-decoration-color var(--dur-press) var(--ease-settle),
    text-decoration-thickness var(--dur-press) var(--ease-settle);
}

button {
  font: inherit;
  color: inherit;
}

/* ---------- Tipografia ---------- */

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-optical-sizing: auto;
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 { font-size: var(--text-h1); }
h2 { font-size: var(--text-h2); }

h3 {
  font-size: var(--text-h3);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: 0;
}

p {
  text-wrap: pretty;
}

strong {
  font-weight: 600;
}

/* ---------- Foco e acessibilidade ---------- */

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

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

.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 100;
  padding: var(--space-3) var(--space-4);
  background: var(--color-ink);
  color: var(--color-white);
  border-radius: var(--radius);
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}
