/* ============================================================
   DOUGLAS VILAR · DESIGN SYSTEM v3 (2026-04-28)
   Single source of truth · Tipografia fluida + tokens.
   Carregado por TODAS as páginas via <link rel="stylesheet">.
   ============================================================ */

/* ============================================================
   TIPOGRAFIA FLUIDA via clamp() — adapta ao viewport
   Sobrescreve html{font-size} hardcoded das páginas legacy.
   ============================================================ */
html {
  /* 17px @ 320px → 22px @ 2400px (suave) */
  font-size: clamp(17px, 0.9rem + 0.45vw, 22px) !important;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

/* Anti-overflow lateral — fim do "comendo as beiradas" */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Headings sem quebras feias (CSS moderno) */
h1, h2, h3, h4 {
  text-wrap: balance;
  overflow-wrap: break-word;
}

/* Parágrafos sem viúvas longas */
p {
  text-wrap: pretty;
}

/* Mídia sempre fluida */
img, video, iframe, svg, canvas {
  max-width: 100%;
  height: auto;
}

/* Container padding mínimo (evita texto colado na borda mobile) */
.wrap, .container, .nav__inner, .nav__in, .topbar__in,
.foot__grid, .foot__bot {
  padding-left: max(1rem, 4vw);
  padding-right: max(1rem, 4vw);
}

/* ====================================================================
   LAYOUT FLUIDO — usa toda a tela em monitores grandes.
   Override de max-width hardcoded em páginas legadas (1200-1280px)
   pra adaptarem em telas 1440p, 4K etc.
   ==================================================================== */
.wrap, .container, .nav__inner, .nav__in, .topbar__in,
main > .wrap, main > .container, main > section > .wrap,
section.wrap, section.container {
  max-width: min(1600px, 94vw) !important;
  margin-left: auto;
  margin-right: auto;
}

/* Em mobile, usa quase toda a tela */
@media (max-width: 720px) {
  .wrap, .container, .nav__inner, .nav__in, .topbar__in {
    max-width: 100% !important;
  }
}

/* Touch target mínimo de 44px em links/botões pequenos no mobile */
@media (max-width: 600px) {
  a, button {
    min-height: 36px;
  }
  .nav__right a, .nav__links a {
    padding: 0.5rem 0.75rem;
  }
}

/* Prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

:root {
  /* ─── BREAKPOINTS (referência — usar em @media) ─── */
  --bp-sm: 480px;
  --bp-md: 768px;
  --bp-lg: 1024px;
  --bp-xl: 1280px;
  --bp-2xl: 1600px;
  --bp-ultrawide: 1920px;

  /* ─── ESPAÇAMENTO (escala fluida) ─── */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --section-y-lg: clamp(5rem, 10vw, 9rem);

  /* ─── BORDAS ─── */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-pill: 100px;
  --radius-full: 9999px;

  /* ─── SOMBRAS (modo escuro padrão) ─── */
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.18);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 24px 56px rgba(0, 0, 0, 0.5);
  --shadow-glow-cyan: 0 0 0 0 rgba(0, 229, 255, 0), 0 12px 32px -8px rgba(0, 229, 255, 0.35);
  --shadow-glow-purple: 0 12px 32px -8px rgba(168, 85, 247, 0.35);
  --shadow-glow-red: 0 12px 32px -8px rgba(255, 61, 61, 0.35);

  /* ─── TRANSIÇÕES ─── */
  --t-fast: 0.15s ease;
  --t-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow: 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  --t-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-theme: 0.35s ease;

  /* ─── ACCENT (variável que muda com tema) ─── */
  --accent: var(--cyan);
  --accent-soft: rgba(0, 229, 255, 0.12);
  --accent-line: rgba(0, 229, 255, 0.35);

  /* ─── Z-INDEX (hierarquia clara) ─── */
  --z-base: 1;
  --z-dropdown: 30;
  --z-sticky: 50;
  --z-overlay: 70;
  --z-drawer: 80;
  --z-modal: 90;
  --z-fab: 9999;
  --z-toast: 10000;
}

:root[data-theme="classic"] {
  --shadow-sm: 0 1px 3px rgba(26, 29, 33, 0.08);
  --shadow-md: 0 8px 20px rgba(26, 29, 33, 0.12);
  --shadow-lg: 0 16px 32px rgba(26, 29, 33, 0.18);
  --shadow-xl: 0 24px 48px rgba(26, 29, 33, 0.22);
  --shadow-glow-cyan: 0 12px 32px -8px rgba(30, 77, 139, 0.25);
  --shadow-glow-purple: 0 12px 32px -8px rgba(107, 78, 143, 0.25);
  --shadow-glow-red: 0 12px 32px -8px rgba(200, 50, 44, 0.25);
  --accent: var(--red);
  --accent-soft: rgba(200, 50, 44, 0.1);
  --accent-line: rgba(200, 50, 44, 0.3);
}

/* ============================================================
   THEME TRANSITION (suave em todas as páginas)
   ============================================================ */
html {
  transition: background-color var(--t-theme), color var(--t-theme);
}
body {
  transition: background-color var(--t-theme), color var(--t-theme);
}
/* View Transitions API (Chrome 111+, Edge 111+) */
@supports (view-transition-name: none) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 0.4s;
  }
}

/* ============================================================
   FOCUS VISÍVEL (acessibilidade WCAG)
   Aparece SÓ em navegação por teclado, não em clique de mouse
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ============================================================
   PREFERS-REDUCED-MOTION
   Desliga TODAS as animações pra usuários sensíveis
   ============================================================ */
@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;
  }
}

/* ============================================================
   SCROLL REVEAL (controlado por IntersectionObserver no JS)
   Elementos com data-reveal entram na tela com fade+slide
   ============================================================ */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, transform;
}
[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}
[data-reveal="fade"] {
  transform: none;
}
[data-reveal="slide-left"] {
  transform: translateX(32px);
}
[data-reveal="slide-left"].is-visible {
  transform: translateX(0);
}
[data-reveal="slide-right"] {
  transform: translateX(-32px);
}
[data-reveal="slide-right"].is-visible {
  transform: translateX(0);
}
[data-reveal="zoom"] {
  transform: scale(0.94);
}
[data-reveal="zoom"].is-visible {
  transform: scale(1);
}
/* Stagger delays */
[data-reveal-delay="1"].is-visible { transition-delay: 0.08s; }
[data-reveal-delay="2"].is-visible { transition-delay: 0.16s; }
[data-reveal-delay="3"].is-visible { transition-delay: 0.24s; }
[data-reveal-delay="4"].is-visible { transition-delay: 0.32s; }
[data-reveal-delay="5"].is-visible { transition-delay: 0.4s; }
[data-reveal-delay="6"].is-visible { transition-delay: 0.48s; }

@media (prefers-reduced-motion: reduce) {
  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ============================================================
   HAMBURGER MOBILE MENU (mobile-first drawer)
   ============================================================ */
.nav__hamburger {
  display: none;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: background var(--t-fast), border-color var(--t-fast);
  flex-shrink: 0;
}
.nav__hamburger:hover {
  background: var(--bg-2);
  border-color: var(--accent);
}
.nav__hamburger__bars {
  position: relative;
  width: 22px;
  height: 14px;
}
.nav__hamburger__bars::before,
.nav__hamburger__bars::after,
.nav__hamburger__bars span {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform var(--t-base), opacity var(--t-fast), top var(--t-base);
}
.nav__hamburger__bars::before { top: 0; }
.nav__hamburger__bars span    { top: 6px; }
.nav__hamburger__bars::after  { top: 12px; }

.nav__hamburger.is-open .nav__hamburger__bars::before {
  top: 6px;
  transform: rotate(45deg);
}
.nav__hamburger.is-open .nav__hamburger__bars::after {
  top: 6px;
  transform: rotate(-45deg);
}
.nav__hamburger.is-open .nav__hamburger__bars span {
  opacity: 0;
}

@media (max-width: 900px) {
  .nav__hamburger { display: inline-flex; }
}

/* DRAWER (overlay full-height à direita) */
.mobile-drawer {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  z-index: var(--z-drawer);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-base);
}
.mobile-drawer.is-open {
  opacity: 1;
  pointer-events: auto;
}
.mobile-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(360px, 88vw);
  height: 100dvh;
  background: var(--bg);
  border-left: 1px solid var(--line);
  padding: 1.25rem 1.25rem 6rem;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform var(--t-base);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.mobile-drawer.is-open .mobile-drawer__panel {
  transform: translateX(0);
}
.mobile-drawer__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.75rem;
}
.mobile-drawer__close {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
}
.mobile-drawer__close:hover {
  background: var(--bg-2);
  border-color: var(--accent);
}
.mobile-drawer__group-label {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 1rem 0 0.4rem;
}
.mobile-drawer a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
  min-height: 44px;
}
.mobile-drawer a:hover,
.mobile-drawer a:focus-visible {
  background: var(--bg-2);
  border-color: var(--accent-line);
  color: var(--accent);
}
.mobile-drawer a.is-hot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 8px rgba(255, 61, 61, 0.7);
  animation: drawerHotPulse 1.6s infinite;
  flex-shrink: 0;
}
@keyframes drawerHotPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}
.mobile-drawer__cta {
  margin-top: 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, #25D366, #128C7E);
  color: #fff !important;
  text-align: center;
  font-weight: 700;
  display: flex !important;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  border: 0 !important;
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.3);
}
.mobile-drawer__cta:hover {
  background: linear-gradient(135deg, #1eb858, #0f7568) !important;
  transform: translateY(-2px);
}

/* Bloqueia scroll do body quando drawer aberto */
body.has-drawer-open {
  overflow: hidden;
}

/* ============================================================
   CARD INTERATIVO (hover lift + shadow grow)
   ============================================================ */
.card-interactive {
  transition: transform var(--t-base), box-shadow var(--t-base), border-color var(--t-base);
}
.card-interactive:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

/* ============================================================
   BOTÃO ACENT (substitui inconsistências)
   ============================================================ */
.btn-accent {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #000;
  font-weight: 600;
  text-decoration: none;
  transition: transform var(--t-base), box-shadow var(--t-base);
}
.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow-cyan);
}
:root[data-theme="classic"] .btn-accent { color: #fff; }
:root[data-theme="classic"] .btn-accent:hover { box-shadow: var(--shadow-glow-red); }

/* ============================================================
   SKIP LINK (acessibilidade — pular pro conteúdo)
   ============================================================ */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent);
  color: #000;
  padding: 0.5rem 1rem;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: var(--z-toast);
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus {
  top: 0;
}

/* ============================================================
   ════════ PALETA OFICIAL DOUGLAS VILAR (v4 · 2026-05) ════════
   Variáveis unificadas para TODO o site e subsites.
   Use sempre var(--dv-*) em vez de cores hardcoded.
   ============================================================ */

:root {
  /* ─── Tipografia (fonts oficiais) ─── */
  --dv-font-serif:    'Cormorant Garamond', 'EB Garamond', Georgia, serif;
  --dv-font-sans:     'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --dv-font-mono:     'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  --dv-font-display:  'Bebas Neue', 'Oswald', 'Impact', sans-serif;

  /* ─── Modo DIREITO (padrão) — navy OAB + dourado ─── */
  --dv-bg:            #0A1628;        /* navy escuro institucional */
  --dv-bg-2:          #0F1E3A;        /* navy mais profundo */
  --dv-bg-card:       rgba(255,255,255,.025);
  --dv-line:          rgba(255,255,255,.08);
  --dv-line-2:        rgba(255,255,255,.14);

  --dv-ink:           #F5F5F7;        /* texto principal */
  --dv-ink-soft:      #B0B0BB;        /* texto secundário */
  --dv-ink-faint:     #6B6B75;        /* texto terciário/labels */

  --dv-accent:        #FFC857;        /* dourado (links, destaques Direito) */
  --dv-accent-2:      #4A8FE0;        /* azul OAB */
  --dv-success:       #22C55E;
  --dv-warning:       #FFC857;
  --dv-danger:        #FF3D3D;
}

/* ─── Modo IA — preto + vermelho neon ─── */
:root[data-mode="ia"] {
  --dv-bg:            #08080A;
  --dv-bg-2:          #0F0F14;
  --dv-bg-card:       rgba(255,255,255,.025);
  --dv-accent:        #FF3D3D;        /* vermelho neon */
  --dv-accent-2:      #A855F7;        /* roxo IA secundário */
}

/* ─── Modo CLÁSSICO (light, opcional p/ páginas específicas) ─── */
:root[data-mode="classic"] {
  --dv-bg:            #F4EFE6;
  --dv-bg-2:          #FAF6EF;
  --dv-bg-card:       rgba(255,255,255,.6);
  --dv-line:          #D9CFBC;
  --dv-line-2:        #C7BBA1;
  --dv-ink:           #1A1D21;
  --dv-ink-soft:      #3F3F46;
  --dv-ink-faint:     #6B6B70;
  --dv-accent:        #B8860B;        /* dourado escuro p/ contraste em light */
  --dv-accent-2:      #1A3A5C;
}

/* Helpers utilitários globais (use em qualquer página) */
.dv-bg        { background: var(--dv-bg) }
.dv-bg-2      { background: var(--dv-bg-2) }
.dv-bg-card   { background: var(--dv-bg-card) }
.dv-ink       { color: var(--dv-ink) }
.dv-ink-soft  { color: var(--dv-ink-soft) }
.dv-ink-faint { color: var(--dv-ink-faint) }
.dv-accent    { color: var(--dv-accent) }
.dv-border    { border-color: var(--dv-line) }

/* Botão padrão da marca (.dv-btn) — substitui botões customizados */
.dv-btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .75rem 1.4rem;
  font-family: var(--dv-font-mono);
  font-size: .78rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  border-radius: 4px;
  border: 1px solid var(--dv-accent);
  color: var(--dv-accent);
  background: transparent;
  text-decoration: none;
  transition: all .2s;
  cursor: pointer;
}
.dv-btn:hover {
  background: var(--dv-accent);
  color: var(--dv-bg);
  transform: translateY(-1px);
}
.dv-btn--ghost {
  border-color: var(--dv-line-2);
  color: var(--dv-ink);
}
.dv-btn--ghost:hover {
  background: rgba(255,255,255,.06);
  color: var(--dv-ink);
}

/* ============================================================
   FIM
   ============================================================ */
