/* =========================================================
   THEME SYSTEM — TOKENS (DARK / LIGHT)
   Fonte única de verdade para todas as cores do portfólio.
   O tema escuro reproduz exatamente os valores originais;
   o tema claro é uma tradução mantendo a mesma hierarquia.
========================================================= */

:root {
  color-scheme: dark;

  /* ---- Superfícies ---- */
  --color-bg: #020617;                 /* fundo das seções */
  --color-bg-rgb: 2, 6, 23;
  --color-body-bg: #0F172A;            /* fundo do body */
  --color-surface-rgb: 255, 255, 255;  /* tint dos cards/bordas translúcidas (glass) */
  --shadow-rgb: 0, 0, 0;               /* sombras ambiente */
  --glass-rgb: 20, 24, 35;             /* botão flutuante (back-to-top) */
  --btn-secondary-bg-rgb: 15, 23, 42;  /* fundo do botão secundário (glass) */

  /* ---- Texto ---- */
  --text-heading: #FFFFFF;
  --text-body: #E5E7EB;
  --text-soft: #CBD5F5;
  --text-soft-rgb: 203, 213, 245;
  --text-list: #C7D2FE;
  --text-muted: #9CA3AF;
  --text-main: var(--text-muted); /* alias legado usado em about_mindset */

  /* ---- Marca / acento ---- */
  --blue-primary: #0A3D91;
  --blue-secondary: #114FA3;
  --blue-accent: #1E6BD6;
  --accent-strong: #2563EB;
  --accent-strong-rgb: 37, 99, 235;
  --accent-text: #93C5FD;
  --accent-text-dim: #6F8FD1;
  --accent-glow-rgb: 59, 130, 246;
  --sky-glow-rgb: 14, 165, 233;
  --cyan-glow-rgb: 0, 140, 255;
  --tag-bg-rgb: 30, 64, 175;
  --tag-border-rgb: 147, 197, 253;
  --dot-accent-start: #007BFF;

  /* ---- Botões (gradiente primário) ---- */
  --btn-primary-grad-1: #2563EB;
  --btn-primary-grad-2: #60A5FA;

  /* ---- Aliases legados (compatibilidade) ---- */
  --white: #FFFFFF;
  --dark-bg: var(--color-body-bg);
  --dark-card: #111827;
  --text-light: var(--text-body);

  /* usados originalmente em minha-atuacao/pratica.css */
  --bg: var(--color-bg);
  --card: rgba(var(--color-surface-rgb), 0.03);
  --border: rgba(var(--color-surface-rgb), 0.08);
  --accent: var(--blue-accent);
  --muted: var(--text-muted);

  --theme-transition-duration: 420ms;
}

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

  /* ---- Superfícies ---- */
  --color-bg: #F2F5FB;
  --color-bg-rgb: 242, 245, 251;
  --color-body-bg: #FFFFFF;
  --color-surface-rgb: 15, 23, 42;
  --shadow-rgb: 30, 41, 59;
  --glass-rgb: 255, 255, 255;
  --btn-secondary-bg-rgb: 255, 255, 255;

  /* ---- Texto ---- */
  --text-heading: #0B1220;
  --text-body: #1E293B;
  --text-soft: #334155;
  --text-soft-rgb: 51, 65, 85;
  --text-list: #33456E;
  --text-muted: #5B6B84;
  --text-main: var(--text-muted);

  /* ---- Marca / acento ---- */
  --blue-primary: #0A3D91;
  --blue-secondary: #114FA3;
  --blue-accent: #1858B3;
  --accent-strong: #1D4ED8;
  --accent-strong-rgb: 29, 78, 216;
  --accent-text: #1D4ED8;
  --accent-text-dim: #4C63A6;
  --accent-glow-rgb: 37, 99, 235;
  --sky-glow-rgb: 2, 132, 199;
  --cyan-glow-rgb: 0, 110, 210;
  --tag-bg-rgb: 219, 231, 254;
  --tag-border-rgb: 29, 78, 216;
  --dot-accent-start: #0B63D6;

  --btn-primary-grad-1: #2563EB;
  --btn-primary-grad-2: #3B82F6;

  --white: #FFFFFF;
  --dark-bg: var(--color-body-bg);
  --dark-card: #EEF2F9;
  --text-light: var(--text-body);

  --bg: var(--color-bg);
  --card: rgba(var(--color-surface-rgb), 0.035);
  --border: rgba(var(--color-surface-rgb), 0.10);
  --accent: var(--blue-accent);
  --muted: var(--text-muted);
}

/* =========================================================
   TOKENS SEMÂNTICOS (ETAPA 1 — BASE VISUAL)
   Camada de nomes por função, para os componentes migrarem
   gradualmente nas próximas etapas. São aliases dos tokens
   acima — como os tokens de origem já variam por tema, uma
   única declaração aqui resolve corretamente em dark e light.
========================================================= */

:root {
  /* Fundos */
  --bg-primary: var(--color-bg);        /* fundo de section */
  --bg-secondary: var(--color-body-bg); /* fundo do body */

  /* Superfícies (cards/painéis translúcidos) */
  --surface: rgba(var(--color-surface-rgb), 0.05);
  --surface-elevated: rgba(var(--color-surface-rgb), 0.10);

  /* Texto */
  --text-primary: var(--text-heading);
  --text-secondary: var(--text-body);
  --text-tertiary: var(--text-muted);

  /* Accent */
  --accent-hover: var(--accent-strong);

  /* Bordas */
  --border-subtle: var(--border);
  --border-strong: rgba(var(--color-surface-rgb), 0.2);

  /* Foco */
  --focus-ring: var(--accent-text);

  /* Estados (hover/seleção genéricos) */
  --state-hover-bg: rgba(var(--color-surface-rgb), 0.06);
  --state-selected-bg: rgba(var(--accent-glow-rgb), 0.10);
  --state-selected-border: var(--blue-accent);
}

/* =========================================================
   TRANSIÇÃO SUAVE ENTRE TEMAS (sem flicker)
   Classe aplicada temporariamente pelo theme.js durante a troca.
========================================================= */

html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
  transition:
    background-color var(--theme-transition-duration) ease,
    background var(--theme-transition-duration) ease,
    color var(--theme-transition-duration) ease,
    border-color var(--theme-transition-duration) ease,
    box-shadow var(--theme-transition-duration) ease,
    fill var(--theme-transition-duration) ease,
    stroke var(--theme-transition-duration) ease !important;
}

html {
  background-color: var(--color-body-bg);
}

/* =========================================================
   GLOW GLOBAL — segue o mouse pela página inteira
   (mesmo efeito que existia apenas no Contato, agora único
   e contínuo, fixo em relação à viewport)
========================================================= */

.mouse-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;

  background: radial-gradient(
    420px 420px at var(--mx, 50%) var(--my, 50%),
    rgba(var(--accent-glow-rgb), 0.28),
    transparent 65%
  );

  opacity: 0;
  transition: opacity 1.2s ease;
}

.mouse-glow.is-active {
  opacity: 1;
}

/* Garante que o conteúdo de cada section fique acima do glow fixo */
body > .hero,
body > .tech-strip,
body > .experience,
body > .about-mindset,
body > .stack,
body > .contact,
body > main.practice {
  position: relative;
  z-index: 1;
}

/* No mobile, efeitos dependentes de mouse ficam desativados */
@media (max-width: 768px) {
  .mouse-glow {
    display: none;
  }
}

/* =========================================================
   THEME TOGGLE — botão elegante Dark/Light
========================================================= */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Uso independente (páginas sem navbar, ex.: minha-atuacao) */
.theme-toggle-fixed {
  position: fixed;
  top: 24px;
  right: 28px;
  z-index: 1000;
}

.theme-toggle-track {
  position: relative;
  display: inline-flex;
  align-items: center;

  width: 60px;
  height: 32px;
  padding: 3px;
  border-radius: 999px;

  background: rgba(var(--color-surface-rgb), 0.08);
  border: 1px solid rgba(var(--tag-border-rgb), 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  box-shadow:
    inset 0 0 0 1px rgba(var(--color-surface-rgb), 0.04),
    0 8px 20px rgba(var(--shadow-rgb), 0.25);

  transition:
    background 0.35s ease,
    border-color 0.35s ease,
    box-shadow 0.35s ease;
}

.theme-toggle-thumb {
  position: relative;
  width: 24px;
  height: 24px;
  border-radius: 50%;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  background: linear-gradient(135deg, var(--btn-primary-grad-1), var(--btn-primary-grad-2));
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(var(--accent-strong-rgb), 0.5);

  transform: translateX(0);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="light"] .theme-toggle-thumb {
  transform: translateX(28px);
}

.theme-toggle-thumb svg {
  position: absolute;
  width: 15px;
  height: 15px;
  transition: opacity 0.3s ease, transform 0.4s ease;
}

.icon-sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0.6);
}

.icon-moon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

[data-theme="light"] .icon-sun {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

[data-theme="light"] .icon-moon {
  opacity: 0;
  transform: rotate(90deg) scale(0.6);
}

.theme-toggle:hover .theme-toggle-track {
  border-color: rgba(var(--tag-border-rgb), 0.6);
}

.theme-toggle:active .theme-toggle-thumb {
  transform: translateX(0) scale(0.92);
}

[data-theme="light"] .theme-toggle:active .theme-toggle-thumb {
  transform: translateX(28px) scale(0.92);
}

.theme-toggle:focus-visible {
  outline: none; /* substituído pelo outline no track abaixo */
}

.theme-toggle:focus-visible .theme-toggle-track {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
}

@media (max-width: 768px) {
  .theme-toggle-fixed {
    top: calc(16px + var(--safe-top));
    right: calc(16px + var(--safe-right));
  }
}
