/* ==========================================================================
   Reset seletivo + base tipográfica e de layout
   ========================================================================== */

@layer reset {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
  :where(body, h1, h2, h3, h4, p, figure, blockquote, dl, dd, ul, ol, fieldset) {
    margin: 0;
  }
  :where(ul, ol) {
    padding: 0;
  }
  :where(ul[role="list"], ol[role="list"], .list-reset) {
    list-style: none;
  }
  :where(img, svg, video, canvas) {
    display: block;
    max-inline-size: 100%;
  }
  :where(img) {
    block-size: auto;
  }
  :where(button, input, select, textarea) {
    font: inherit;
    color: inherit;
  }
  :where(button) {
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  :where(a) {
    color: inherit;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }
  :where(summary) {
    cursor: pointer;
  }
  :where(table) {
    border-collapse: collapse;
  }
  [hidden] {
    display: none !important;
  }
}

@layer base {
  html {
    color-scheme: light;
    background: var(--forest-950);
    scroll-padding-block-start: 6rem;
    interpolate-size: allow-keywords;
  }

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

  body {
    min-block-size: 100vh;
    min-block-size: 100dvh;
    font-family: var(--font-sans);
    font-size: var(--fs-md);
    font-weight: 400;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    font-synthesis: none;
    font-optical-sizing: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: clip;
  }

  /* Textura de papel: camada fixa, sem interação, não repinta ao rolar. */
  body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  }

  main,
  header,
  footer {
    position: relative;
    z-index: 1;
  }

  ::selection {
    background: var(--gold-500);
    color: var(--forest-900);
  }

  /* ---------- Tipografia ---------- */
  :where(h1, h2, h3, h4) {
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.06;
    text-wrap: balance;
  }
  h1 {
    font-size: var(--fs-h1);
    letter-spacing: -0.04em;
    line-height: 1.02;
  }
  :where(h1, h2) {
    word-spacing: 0.06em;
  }
  h2 {
    font-size: var(--fs-h2);
  }
  h3 {
    font-size: var(--fs-xl);
    font-weight: 700;
    letter-spacing: -0.022em;
    line-height: 1.18;
  }
  :where(p, li, blockquote) {
    text-wrap: pretty;
  }
  strong,
  b {
    font-weight: 700;
  }
  .lead {
    font-size: var(--fs-lg);
    line-height: 1.6;
    color: var(--text-2);
    max-inline-size: 58ch;
  }
  .small {
    font-size: var(--fs-xs);
    line-height: 1.55;
    color: var(--text-3);
  }
  .tnum {
    font-variant-numeric: tabular-nums;
  }

  /* ---------- Layout ---------- */
  .container {
    inline-size: min(100% - 2 * var(--gutter), var(--container));
    margin-inline: auto;
  }
  .section {
    position: relative;
    padding-block: var(--section-y);
    background: var(--bg);
    color: var(--text);
  }
  .section__head {
    display: grid;
    gap: 1rem;
    max-inline-size: 46rem;
    margin-block-end: clamp(2rem, 1rem + 4vw, 4rem);
  }

  /* ---------- Acessibilidade ---------- */
  :where(a, button, summary, input, select, textarea, [tabindex]):focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
  }
  .sr-only {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }
  .skip-link {
    position: fixed;
    inset-block-start: 0.75rem;
    inset-inline-start: 0.75rem;
    z-index: 60;
    padding: 0.75rem 1.1rem;
    border-radius: var(--r-pill);
    background: var(--gold-500);
    color: var(--forest-900);
    font-weight: 700;
    transform: translateY(-200%);
    transition: transform 0.2s var(--ease-out);
  }
  .skip-link:focus-visible {
    transform: none;
  }

  /* Alvos de toque confortáveis em telas de toque */
  @media (pointer: coarse) {
    :where(.btn, .chip-btn, summary) {
      min-block-size: 3rem;
    }
  }
}
