/* ==========================================================================
   Carnow Pro - Dark Mode
   --------------------------------------------------------------------------
   Sobrescreve o subset de CSS variables que controlam cor/fundo/borda.
   --color-primary (vermelho de marca) e mantido identico.
   Inclui ajustes de leitura (line-height, max-width) que aplicam em ambos
   os temas.
   ========================================================================== */

/* Transicao suave ao trocar tema (apenas cor; respeita reduce-motion). */
html {
  transition: background-color 200ms ease, color 200ms ease;
}

@media (prefers-reduced-motion: reduce) {
  html {
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   Dark theme tokens
   -------------------------------------------------------------------------- */
html[data-theme="dark"] {
  /* Neutros invertidos. Mantemos o nome --color-gray-* mas com tons noturnos. */
  --color-white: #0f1419;          /* "branco" no contexto dark = bg primario */
  --color-gray-50: #131820;        /* superficies elevadas (cards) */
  --color-gray-100: #1a2030;       /* superficies elevadas (cards/popups) */
  --color-gray-200: #232a3a;       /* bordas sutis */
  --color-gray-300: #2e3548;       /* bordas */
  --color-gray-400: #6b7280;       /* texto desabilitado / placeholder */
  --color-gray-500: #9ca3af;       /* texto secundario / muted */
  --color-gray-600: #c8cdd6;       /* texto regular */
  --color-gray-700: #d8dde6;       /* texto regular (mais forte) */
  --color-gray-800: #e6e9f0;       /* texto principal */
  --color-gray-900: #f3f4f6;       /* headings */
  --color-black: #ffffff;          /* "preto" inverte para branco */

  /* Secundario (era cinza muito escuro) clareia para nao sumir. */
  --color-secondary: #e6e9f0;

  /* Sombras: muito mais opacas em dark pois fundo nao e branco. */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.55);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);

  /* color-scheme nativo: ajusta scrollbars, form controls, etc. */
  color-scheme: dark;
}

html[data-theme="light"] {
  color-scheme: light;
}

/* --------------------------------------------------------------------------
   Tratamento de imagens em dark
   Suaviza brilho excessivo, mas nao toca em logos marcados com .no-dim
   -------------------------------------------------------------------------- */
html[data-theme="dark"] img:not(.no-dim):not([data-no-dim]) {
  filter: brightness(0.92);
}

/* --------------------------------------------------------------------------
   Leitura confortavel (aplica em LIGHT e DARK)
   -------------------------------------------------------------------------- */
.entry-content {
  line-height: 1.75;
}

.entry-content {
  /* Se o tema ja define max-width em outro seletor, este max-width somente
     entra em vigor se nao for sobrescrito. Usar 70ch garante medida ideal
     de leitura (~65-75 caracteres por linha). */
  max-width: 70ch;
  margin-left: auto;
  margin-right: auto;
}

.entry-content p,
.entry-content li {
  line-height: 1.75;
}

/* --------------------------------------------------------------------------
   Toggle button
   -------------------------------------------------------------------------- */
.carnow-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--color-gray-700);
  cursor: pointer;
  transition: background-color 200ms ease, color 200ms ease, transform 200ms ease;
  -webkit-appearance: none;
  appearance: none;
  line-height: 0;
}

.carnow-theme-toggle:hover {
  background-color: var(--color-gray-100);
  color: var(--color-gray-900);
}

.carnow-theme-toggle:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.carnow-theme-toggle:active {
  transform: scale(0.94);
}

.carnow-theme-toggle svg {
  width: 20px;
  height: 20px;
  display: block;
}

@media (prefers-reduced-motion: reduce) {
  .carnow-theme-toggle {
    transition: none;
  }
  .carnow-theme-toggle:active {
    transform: none;
  }
}
