/**
 * MOEDABR 2.0 - GLOBAL CSS V7.2 (BLEND CABULOSO)
 * Performance-First | Mobile-First | Enterprise-Level
 * Meta: Lighthouse 100/100 | FCP < 1s | TTI < 1.5s
 *
 * Filosofia deste blend:
 * - Mantém sua base robusta (utilitários, layout, componentes globais)
 * - Elimina qualquer sub-tom azulado (UA defaults inclusive)
 * - Introduz tokens semânticos (surface/content) sem quebrar legado
 * - Breakpoints como tokens + @custom-media (para código mais limpo)
 * - Utilitários "educados" (prefixo u- com :where()) coexistindo com os antigos
 * - Menos risco de CLS nos headings (step por breakpoint)
 *
 * Aviso do auditor ranzinza:
 * - Nada de !important (exceto se o mundo acabar)
 * - @font-display só dentro de @font-face (aqui estava solto... removido)
 */

/* ===================================
   DESIGN TOKENS — PALETA NEUTRA + OURO
=================================== */
:root {
  /* ── BRAND ── */
  --brand-gold: #FFD700;
  --brand-gold-hover: #FFC700;
  --brand-gold-active: #E6C200;
  --brand-gold-rgb: 255, 215, 0;

  /* ── BACKGROUNDS (neutralizadas — adeus azul fantasma) ── */
  --bg-primary:   #0b0b0b; /* era #0a0a1a */
  --bg-secondary: #121212; /* ok */
  --bg-tertiary:  #1a1a1a; /* era #1a1a2e */
  --bg-accent:    #0e0e0e; /* era #0f0f1f */
  --bg-overlay:   rgba(0, 0, 0, 0.8);

  /* ── TEXT (mantidos para compat) ── */
  --text-primary:   #fafafa;
  --text-secondary: #cfcfcf;
  --text-tertiary:  #8a8a8a;
  --text-inverse:   #0b0b0b;

  /* ── ESTADOS & EFEITOS ── */
  --border-subtle:   rgba(255, 255, 255, 0.08);
  --border-moderate: rgba(255, 255, 255, 0.16);
  --border-emphasis: rgba(255, 215, 0, 0.4);
  --hover-overlay:   rgba(255, 215, 0, 0.08);
  --focus-ring:      0 0 0 3px rgba(255, 215, 0, 0.32);

  /* Estados adicionais (faltantes) */
  --status-success: #22c55e;
  --status-warning: #f59e0b;
  --status-error:   #ef4444;

  /* ── SPACING (4px base) ── */
  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem; --space-4: 1rem;
  --space-5: 1.25rem; --space-6: 1.5rem; --space-8: 2rem; --space-10: 2.5rem;
  --space-12: 3rem; --space-16: 4rem; --space-20: 5rem;

  /* ── TYPE SCALE ── */
  --text-xs: 0.75rem; --text-sm: 0.875rem; --text-base: 1rem;
  --text-lg: 1.125rem; --text-xl: 1.25rem; --text-2xl: 1.5rem;
  --text-3xl: 1.875rem; --text-4xl: 2.25rem; --text-5xl: 3rem;

  /* ── CONTAINERS ── */
  --container-xs: 480px; --container-sm: 640px; --container-md: 768px;
  --container-lg: 1024px; --container-xl: 1280px; --container-max: 1400px;

  /* ── BREAKPOINT TOKENS ── */
  --bp-sm: 640px; --bp-md: 768px; --bp-lg: 1024px; --bp-xl: 1280px;

  /* ── TIMING / EASING ── */
  --timing-fast: 0.15s ease-out;
  --timing-base: 0.25s ease-out;
  --timing-slow: 0.4s ease-out;
  --easing-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ── SHADOWS ── */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.28);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.42);
  --shadow-gold: 0 8px 32px rgba(var(--brand-gold-rgb), 0.28);

  /* ── RADII ── */
  --radius-sm: 0.25rem; --radius-md: 0.5rem; --radius-lg: 0.75rem;
  --radius-xl: 1rem; --radius-full: 50%;

  /* ── Z-INDEX ── */
  --z-base: 1; --z-dropdown: 100; --z-sticky: 200; --z-modal: 1000;
  --z-popover: 2000; --z-tooltip: 3000; --z-debug: 9999;

  /* ── ALIASES SEMÂNTICOS (para o futuro elegante) ── */
  --surface-1: var(--bg-primary);
  --surface-2: var(--bg-secondary);
  --surface-3: var(--bg-tertiary);
  --surface-overlay: var(--bg-overlay);

  --content-1: var(--text-primary);
  --content-2: var(--text-secondary);
  --content-3: var(--text-tertiary);
}

/* Custom Media — se usa PostCSS, isso vira açúcar sintático delicioso */
@custom-media --sm (min-width: 640px);
@custom-media --md (min-width: 768px);
@custom-media --lg (min-width: 1024px);
@custom-media --xl (min-width: 1280px);

/* ===================================
   RESET/BASE — SEM DRAMA, SEM AZUL
=================================== */
*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  line-height: 1.6;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  height: 100%;
  color-scheme: dark; /* navegador, colabore e fique dark */
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI',
               Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--surface-1);
  color: var(--content-1);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===================================
   LAYOUT SYSTEM — MOBILE FIRST
=================================== */
.container {
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--space-4);
  max-width: var(--container-max);
}
.container--sm { max-width: var(--container-sm); }
.container--md { max-width: var(--container-md); }
.container--lg { max-width: var(--container-lg); }
.container--xl { max-width: var(--container-xl); }

.main-content { flex: 1; min-height: 0; }

/* ===================================
   TIPOGRAFIA — ESTÁVEL (menos CLS)
=================================== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700; line-height: 1.2; color: var(--content-1);
  margin-bottom: var(--space-4);
  font-feature-settings: 'kern', 'liga', 'clig', 'calt';
}

/* Base mobile */
h1{font-size:var(--text-3xl);} h2{font-size:var(--text-2xl);} h3{font-size:var(--text-xl);}
h4{font-size:var(--text-lg);}  h5{font-size:var(--text-base);} h6{font-size:var(--text-sm);}

/* md+ — cresce com dignidade, sem pular layout */
@media (--md) {
  h1{font-size:var(--text-5xl);} h2{font-size:var(--text-4xl);} h3{font-size:var(--text-3xl);}
  h4{font-size:var(--text-2xl);} h5{font-size:var(--text-xl);} h6{font-size:var(--text-base);}
}

/* Texto corrente */
p {
  margin-bottom: var(--space-4);
  color: var(--content-2);
  max-width: 65ch; /* legibilidade de gente grande */
}

/* Links — sem azul do UA, com foco visível */
a {
  color: var(--content-2);
  text-decoration: none;
  transition: color var(--timing-fast);
}
a:hover { color: var(--brand-gold); }
a:visited { color: var(--content-2); } /* tchau, roxo azulado */
a:focus-visible {
  outline: 2px solid var(--brand-gold);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Seleção de texto — nada de marca-texto azul */
::selection {
  background: rgba(var(--brand-gold-rgb), .24);
  color: var(--content-1);
}

/* ===================================
   FORM CONTROLS — PADRÃO ESCURO
=================================== */
input, select, textarea, button {
  color: var(--content-1);
  background-color: var(--surface-2);
  border: 1px solid var(--border-subtle);
  accent-color: var(--brand-gold);  /* check/radio/slider no padrão */
  caret-color: var(--brand-gold);
}
input::placeholder, textarea::placeholder { color: var(--content-3); }
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 2px solid var(--brand-gold);
  outline-offset: 2px;
}

/* ===================================
   COMPONENT FOUNDATIONS
=================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: var(--space-3) var(--space-6);
  border: none; border-radius: var(--radius-md);
  font-weight: 600; font-size: var(--text-base); line-height: 1;
  cursor: pointer; transition: all var(--timing-base);
  min-height: 44px; min-width: 44px;
  text-decoration: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
.btn--primary {
  background: var(--brand-gold);
  color: var(--text-inverse);
}
.btn--primary:hover {
  background: var(--brand-gold-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-gold);
}
.btn--secondary {
  background: transparent;
  color: var(--content-1);
  border: 1px solid var(--border-moderate);
}
.btn--secondary:hover {
  background: var(--hover-overlay);
  border-color: var(--brand-gold);
  color: var(--brand-gold);
}

.card {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: all var(--timing-base);
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-emphasis);
}

/* ===================================
   UTILITIES (LEGADO) — MANTIDOS
   Observação: podem conflitar; novos utilitários abaixo são "educados".
=================================== */
.block { display: block; }
.inline-block { display: inline-block; }
.inline { display: inline; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.hidden { display: none; }

.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.m-0 { margin: 0; }
.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }
.mt-8 { margin-top: var(--space-8); }
.mb-8 { margin-bottom: var(--space-8); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-primary { color: var(--content-1); }
.text-secondary { color: var(--content-2); }
.text-tertiary { color: var(--content-3); }
.text-gold { color: var(--brand-gold); }

.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }

/* ===================================
   UTILITIES (NOVOS) — PREFIXO u-, ESPECIFICIDADE 0
   Traduzindo: não brigam com componentes.
=================================== */
:where(.u-text-1){ color: var(--content-1); }
:where(.u-text-2){ color: var(--content-2); }
:where(.u-text-3){ color: var(--content-3); }
:where(.u-text-gold){ color: var(--brand-gold); }

:where(.u-block){display:block;} :where(.u-inline){display:inline;}
:where(.u-flex){display:flex;}  :where(.u-grid){display:grid;} :where(.u-hidden){display:none;}

:where(.u-mt-4){margin-top:var(--space-4);} :where(.u-mb-4){margin-bottom:var(--space-4);}
:where(.u-p-4){padding:var(--space-4);} :where(.u-px-4){padding-inline:var(--space-4);} :where(.u-py-4){padding-block:var(--space-4);}

:where(.u-notice-success){
  background: color-mix(in oklab, var(--status-success) 16%, black);
  border: 1px solid color-mix(in oklab, var(--status-success) 42%, black);
}
:where(.u-notice-warning){
  background: color-mix(in oklab, var(--status-warning) 16%, black);
  border: 1px solid color-mix(in oklab, var(--status-warning) 42%, black);
}
:where(.u-notice-error){
  background: color-mix(in oklab, var(--status-error) 16%, black);
  border: 1px solid color-mix(in oklab, var(--status-error) 42%, black);
}

/* Responsivos com custom-media (futuro sem .md\:… hardcoded) */
@media (--md){ :where(.md-u-block){display:block;} :where(.md-u-hidden){display:none;} :where(.md-u-grid-3){grid-template-columns:repeat(3,1fr);} }
@media (--lg){ :where(.lg-u-grid-4){grid-template-columns:repeat(4,1fr);} }

/* ===================================
   RESPONSIVE — LEGADO (mantido)
=================================== */
@media (min-width: 768px) {
  .container { padding: 0 var(--space-6); }
  .md\:grid-2 { grid-template-columns: repeat(2, 1fr); }
  .md\:grid-3 { grid-template-columns: repeat(3, 1fr); }
  .md\:block { display: block; }
  .md\:hidden { display: none; }
}
@media (min-width: 1024px) {
  .container { padding: 0 var(--space-8); }
  .lg\:grid-3 { grid-template-columns: repeat(3, 1fr); }
  .lg\:grid-4 { grid-template-columns: repeat(4, 1fr); }
  .lg\:block { display: block; }
  .lg\:hidden { display: none; }
}

/* ===================================
   PERFORMANCE & ACESSIBILIDADE
=================================== */
.will-change-transform { will-change: transform; } /* use com parcimônia */
.transform-gpu { transform: translateZ(0); }       /* só quando precisa */

@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;
  }
}

/* Screen reader only */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Alto contraste */
@media (prefers-contrast: high) {
  :root {
    --bg-primary: #000000;
    --text-primary: #ffffff;
    --border-subtle: rgba(255, 255, 255, 0.5);
  }
}

/* ===================================
   MÍDIA & SCROLLBARS — SEM AZUL
=================================== */
img, video, iframe { max-width: 100%; height: auto; display: block; }

/* Scrollbar dark padrão */
* { scrollbar-color: #2a2a2a #0e0e0e; scrollbar-width: thin; }
*::-webkit-scrollbar        { width: 8px; height: 8px; }
*::-webkit-scrollbar-track  { background: #0e0e0e; }
*::-webkit-scrollbar-thumb  { background: #2a2a2a; border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: #3a3a3a; }

/* ===================================
   CONTAINMENT
=================================== */
.contain-layout { contain: layout; }
.contain-paint  { contain: paint; }

/* ===================================
   DEBUG (DEV ONLY) — NADA DE !important
=================================== */
.debug { outline: 1px solid red; }
.debug * { outline: 1px solid blue; }

/* ===================================
   PRINT
=================================== */
@media print {
  .no-print { display: none !important; }
  * { background: transparent !important; color: black !important; box-shadow: none !important; }
  a, a:visited { text-decoration: underline; }
}
