/* Melhorias globais de UX, acessibilidade e responsividade */

:root {
  color-scheme: dark;
}

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

body {
  overflow-x: hidden;
}

/* Evita salto visual enquanto imagens carregam. */
img {
  max-width: 100%;
  height: auto;
}

img[width][height] {
  height: auto;
}

/* Foco visível para navegação por teclado. */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 3px;
}

/* Alvos de toque mais confortáveis em telas pequenas. */
@media (max-width: 768px) {
  :where(button, .btn, .nav-link, .language-option, .icon-btn) {
    min-height: 44px;
  }
}

/* Entrada discreta dos conteúdos, sem esconder nada quando JS está desativado. */
.js .reveal-on-scroll {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .55s ease, transform .55s ease;
}

.js .reveal-on-scroll.is-visible {
  opacity: 1;
  transform: none;
}

/* Botão global de retorno ao topo. */
.back-to-top {
  position: fixed;
  right: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1rem, 3vw, 2rem);
  z-index: 90;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  background: rgba(9,9,11,.86);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px rgba(0,0,0,.28);
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.back-to-top:hover {
  transform: translateY(-2px);
}

/* Respeita usuários que preferem menos movimento. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }

  .js .reveal-on-scroll {
    opacity: 1;
    transform: none;
  }
}
