/*
 * ============================================================
 * TIRZEAPP — RESET & BASE
 * ============================================================
 * Reset moderno + contenção estrutural de overflow.
 *
 * DECISÃO DE ARQUITETURA:
 * overflow-x: clip em html + body NÃO é máscara — é contenção
 * legítima combinada com width: 100% em todos os containers.
 * Nenhum elemento usa width: 100vw (causa scroll lateral).
 * box-sizing: border-box é global e previne padding overflow.
 * ============================================================
 */

/* ── Contenção estrutural raiz ── */
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  tab-size: 4;

  /* Contenção de largura — estrutural, não cosmética */
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

body {
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-base);
  color: var(--color-text-primary);
  background-color: var(--color-bg-root);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;

  /* Contenção estrutural — complementa html */
  width: 100%;
  max-width: 100%;
  overflow-x: clip;

  /* Previne que position: fixed/absolute de filhos cause scroll */
  position: relative;
}

/* ── Box-sizing global — previne padding/border quebrando largura ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;

  /* Contenção de largura máxima em todos os elementos */
  max-width: 100%;
}

/* Exceções legítimas ao max-width: 100% global */
svg,
canvas,
video,
audio {
  max-width: none; /* controlados individualmente */
}

/* ── Mídia — contida por padrão ── */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ── Formulários — herdam fonte e não quebram largura ── */
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
  /* Inputs sem width explícito não devem exceder o pai */
  max-width: 100%;
}

/* ── Tipografia — quebra de texto estrutural ── */
p,
h1, h2, h3, h4, h5, h6,
span,
label,
li,
td,
th {
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

/* Títulos: hifenização suave, não agressiva */
h1, h2, h3 {
  hyphens: manual;
  word-break: normal;
  overflow-wrap: break-word;
}

/* ── Listas ── */
ul, ol {
  list-style: none;
}

/* ── Links ── */
a {
  color: inherit;
  text-decoration: none;
}

/* ── Botões ── */
button {
  cursor: pointer;
  border: none;
  background: none;

  /* Garante que botões não causem overflow */
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Scrollbar sutil e monocromática ── */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: var(--color-surface-01);
}

::-webkit-scrollbar-thumb {
  background: var(--color-surface-05);
  border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-surface-06);
}

/* ── Seleção de texto ── */
::selection {
  background: rgba(255, 255, 255, 0.15);
  color: var(--color-text-primary);
}

/* ── Focus visible — acessível e elegante ── */
:focus-visible {
  outline: 1px solid rgba(255, 255, 255, 0.5);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

:focus:not(:focus-visible) {
  outline: none;
}
