/* =============================================================================
   Mel — base.css
   Reset moderno + estilos de elementos base. Mobile-first.
   ============================================================================= */

/* ---------------------------------------------------------------------------
   Reset
   --------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100dvh;
  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);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Mídia responsiva por padrão */
img,
picture,
svg,
video {
  display: block;
  max-width: 100%;
}

/* Herança de fonte nos controles */
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

/* Remove estilos de lista onde não fizer sentido */
ul[role='list'],
ol[role='list'] {
  list-style: none;
}

/* ---------------------------------------------------------------------------
   Tipografia base
   --------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  line-height: var(--line-height-tight);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  text-wrap: balance;
}

h1 { font-size: var(--font-size-xl); }
h2 { font-size: var(--font-size-lg); }
h3 { font-size: var(--font-size-md); }
h4 { font-size: var(--font-size-base); }

p {
  text-wrap: pretty;
}

small {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

strong,
b {
  font-weight: var(--font-weight-bold);
}

/* ---------------------------------------------------------------------------
   Links
   --------------------------------------------------------------------------- */
a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-dark);
}

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

/* ---------------------------------------------------------------------------
   Foco visível padrão (acessibilidade)
   --------------------------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------------------
   Controles de formulário base
   --------------------------------------------------------------------------- */
button {
  cursor: pointer;
  border: none;
  background: none;
  min-height: var(--touch-target);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
textarea,
select {
  width: 100%;
  min-height: var(--control-height);
}

textarea {
  resize: vertical;
  min-height: calc(var(--control-height) * 2);
}

/* Remove aparência nativa de números/data em iOS */
input[type='number'] {
  -moz-appearance: textfield;
  appearance: textfield;
}
input[type='number']::-webkit-outer-spin-button,
input[type='number']::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Placeholder com o tom mudo da marca */
::placeholder {
  color: var(--color-text-muted);
  opacity: 0.8;
}

/* ---------------------------------------------------------------------------
   Utilitários genéricos
   --------------------------------------------------------------------------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none !important;
}

.text-muted   { color: var(--color-text-muted); }
.text-danger  { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-center  { text-align: center; }

/* ---------------------------------------------------------------------------
   Scrollbar discreta
   --------------------------------------------------------------------------- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-strong) transparent;
}

/* Respeita preferência de menos movimento */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
