/**
 * Base e escala tipográfica.
 *
 * Todos os tamanhos vem dos tokens e sao fixos em qualquer viewport — e o que
 * o handoff faz nas proprias telas (Display roda a 48px numa pagina de 1056px
 * de largura). Nada de clamp() aqui: seria inventar uma escala fluida que o
 * design system nao tem. Ver docs/adr/0004-escala-tipografica-fixa.md.
 */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

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

button {
  cursor: pointer;
}

/* O UA declara [hidden]{display:none}, mas qualquer `display` de autor vence
   por especificidade — e painéis com display:flex reapareceriam mesmo ocultos.
   Esta linha é o que faz `elemento.hidden = true` significar o que aparenta. */
[hidden] {
  display: none !important;
}

:where(ul, ol)[role='list'] {
  list-style: none;
  padding: 0;
}

::selection {
  background: var(--coral);
  color: var(--ink);
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---- Foco -------------------------------------------------------------- */

:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--r-sm);
}

/* O anel padrao ja e visivel; remove so o outline nativo redundante. */
:focus:not(:focus-visible) {
  outline: none;
}

.skip-link {
  position: absolute;
  left: var(--s-4);
  top: var(--s-4);
  z-index: 100;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-sm);
  background: var(--coral);
  color: var(--offwhite);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: var(--ls-label);
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: translateY(0);
}

/* ---- Escala tipográfica (handoff, seção 04) ---------------------------- */

.t-display {
  font-size: var(--fs-display);
  line-height: var(--lh-display);
  letter-spacing: var(--ls-display);
  font-weight: 800;
  text-wrap: balance;
}

.t-h1 {
  font-size: var(--fs-h1);
  line-height: var(--lh-h1);
  letter-spacing: var(--ls-h1);
  font-weight: 800;
  text-wrap: balance;
}

.t-h2 {
  font-size: var(--fs-h2);
  line-height: var(--lh-h2);
  letter-spacing: -0.005em;
  font-weight: 700;
  text-wrap: balance;
}

.t-h3 {
  font-size: var(--fs-h3);
  line-height: var(--lh-h3);
  font-weight: 600;
}

.t-body-l {
  font-size: var(--fs-body-l);
  line-height: var(--lh-body);
  font-weight: 400;
}

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

.t-label {
  font-size: var(--fs-label);
  line-height: 1.4;
  letter-spacing: var(--ls-label);
  font-weight: 600;
}

/* Caixa alta so aqui e no label — regra do handoff, seção 04. */
.t-overline {
  font-size: var(--fs-overline);
  line-height: 1.3;
  letter-spacing: var(--ls-overline);
  text-transform: uppercase;
  font-weight: 600;
}

.t-muted {
  color: var(--text-muted);
}

.t-secondary {
  color: var(--text-secondary);
}

.measure {
  max-width: var(--measure);
}

.measure-narrow {
  max-width: var(--measure-narrow);
}

/* ---- Layout ------------------------------------------------------------ */

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

@media (min-width: 768px) {
  .container {
    padding-inline: var(--s-6);
  }
}

.stack {
  display: flex;
  flex-direction: column;
}

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

@media (min-width: 768px) {
  .section {
    padding-block: var(--s-8);
  }
}

/* ---- Motivo grafico ---------------------------------------------------- */

/* Layer lines como camada decorativa. Sempre em ::before com aria-hidden
   implícito (pseudo-elemento nao entra na árvore de acessibilidade) e nunca
   atras de corpo de texto — regra do handoff, seção 06. */
.layer-lines {
  position: relative;
  isolation: isolate;
}

.layer-lines::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: var(--layer-lines-8);
  pointer-events: none;
}

/* Faixa Molten no topo de superfícies de destaque. */
.molten-rule {
  height: 6px;
  background: linear-gradient(90deg, #ffb020 0%, #ff5c39 50%, #e8318c 100%);
}

/* Texto no degradê: so em display curto, nunca em corpo (handoff, seção 01.2).
   O fallback em coral cobre navegador sem background-clip. */
.molten-text {
  color: var(--coral);
  background: var(--molten-diagonal);
  -webkit-background-clip: text;
  background-clip: text;
}

@supports (-webkit-background-clip: text) or (background-clip: text) {
  .molten-text {
    color: transparent;
  }
}

/* ---- Prosa ------------------------------------------------------------- */

/* Conteudo vindo de markdown. Precisa ser global: o HTML e gerado em tempo de
   build e nao carrega os hashes de escopo dos componentes .astro. */
.prosa > * + * {
  margin-top: var(--s-3);
}

.prosa p {
  font-size: inherit;
  line-height: var(--lh-body);
}

.prosa strong {
  font-weight: 600;
  color: var(--text-primary);
}

.prosa a {
  color: var(--coral);
  font-weight: 600;
}

.prosa ul,
.prosa ol {
  padding-left: 1.15em;
}

.prosa li + li {
  margin-top: var(--s-2);
}

/* ---- Utilitarios ------------------------------------------------------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

a {
  color: var(--coral);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--amber);
}
