/* ═══════════════════════════════════════
   GLOBAL BASE — Isaac Amaral / Grupo Insight
   Reset · Utilities · Keyframes · Reveals
═══════════════════════════════════════ */

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

/* ── Root ── */
html {
  scroll-behavior: smooth;
  font-size: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--purple-30) var(--void);
}

/* ── Body ── */
body {
  background:
    radial-gradient(ellipse at 15% 5%,  rgba(73, 36, 245, 0.32) 0%, transparent 45%),
    radial-gradient(ellipse at 85% 18%, rgba(30, 64, 175, 0.18) 0%, transparent 40%),
    radial-gradient(ellipse at 10% 55%, rgba(73, 36, 245, 0.06) 0%, transparent 40%),
    radial-gradient(ellipse at 90% 70%, rgba(73, 36, 245, 0.10) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 100%, rgba(30, 64, 175, 0.22) 0%, transparent 50%),
    #070710;
  color: var(--white);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Element resets ── */
a { text-decoration: none; color: inherit; }
button { font-family: inherit; }
img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; }

h1, h2, h3, h4, h5, h6, p, blockquote, li, span {
  overflow-wrap: break-word;
  word-break: break-word;
}

/* ── Typography hierarchy ── */
h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.1;
}

h1 {
  font-size: var(--text-hero);
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
}

h2 {
  font-size: var(--text-h2);
  font-weight: 700;
  letter-spacing: var(--tracking-display);
}

h3 {
  font-size: var(--text-h3);
  font-weight: 600;
}


/* ═══════════════════════════════════════
   CUSTOM CURSOR
═══════════════════════════════════════ */

@media (pointer: fine) {
  body { cursor: none; }
  a, button, input, select, textarea, [role="button"] { cursor: none; }
}

.cursor-dot {
  position: fixed;
  top: 0; left: 0;
  width: 6px;
  height: 6px;
  background: var(--white);
  border-radius: 50%;
  pointer-events: none;
  z-index: var(--z-cursor);
  transform: translate(-50%, -50%);
  transition: width 0.2s var(--ease), height 0.2s var(--ease), background 0.2s var(--ease);
  mix-blend-mode: difference;
}

/* Quando modal com backdrop-filter está aberto, o mix-blend-mode contra
   o fundo borrado torna o cursor invisível. Desliga o blend nesses casos. */
body.modal-open .cursor-dot { mix-blend-mode: normal; background: var(--purple); }
body.modal-open .cursor-ring { border-color: var(--purple); }

.cursor-ring {
  position: fixed;
  top: 0; left: 0;
  width: 36px;
  height: 36px;
  border: 1.5px solid rgba(73, 36, 245, 0.5);
  border-radius: 50%;
  pointer-events: none;
  z-index: calc(var(--z-cursor) - 1);
  transform: translate(-50%, -50%);
  transition: width 0.25s var(--ease-out-expo), height 0.25s var(--ease-out-expo),
              border-color 0.25s var(--ease), opacity 0.25s var(--ease);
  opacity: 0.7;
}

/* Hover state — expand ring */
.cursor-dot.is-hover {
  width: 10px;
  height: 10px;
  background: var(--purple);
}

.cursor-ring.is-hover {
  width: 50px;
  height: 50px;
  border-color: var(--purple);
  opacity: 1;
}

/* Hide on touch / mobile */
@media (pointer: coarse) {
  .cursor-dot, .cursor-ring { display: none; }
}

@media (max-width: 768px) {
  .cursor-dot, .cursor-ring { display: none; }
  body { cursor: auto; }
  a, button, input, select, textarea, [role="button"] { cursor: auto; }
}


/* ═══════════════════════════════════════
   FOCUS & ACCESSIBILITY
═══════════════════════════════════════ */

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}

.skip-to-content {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: var(--z-cursor);
  background: var(--purple);
  color: var(--white);
  padding: 12px 24px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: top 0.2s var(--ease);
}

.skip-to-content:focus { top: 0; }

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


/* ═══════════════════════════════════════
   LAYOUT UTILITIES
═══════════════════════════════════════ */

.section-padding {
  padding: var(--section-py) var(--section-px);
}

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  width: 100%;
}

.container--narrow {
  max-width: var(--max-w-narrow);
}


/* ═══════════════════════════════════════
   COLOR UTILITIES
═══════════════════════════════════════ */

.text-purple   { color: var(--purple); }
.text-gray     { color: var(--gray); }
.text-white    { color: var(--white); }


/* ═══════════════════════════════════════
   SECTION TITLES
═══════════════════════════════════════ */

.section-title {
  font-size: var(--text-h2);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: var(--tracking-display);
  color: var(--white);
  margin-bottom: 28px;
  text-wrap: balance;
}

.section-title span {
  color: var(--purple);
}


/* ═══════════════════════════════════════
   SELECTION & SCROLLBAR
═══════════════════════════════════════ */

::selection {
  background: var(--purple);
  color: var(--white);
}

::-moz-selection {
  background: var(--purple);
  color: var(--white);
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--void); }
::-webkit-scrollbar-thumb {
  background: var(--purple-30);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--purple); }


/* ═══════════════════════════════════════
   KEYFRAMES — Essentials only
═══════════════════════════════════════ */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}

@keyframes spinSelf {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes scrollLine {
  0%   { transform: scaleY(0); transform-origin: top; }
  49%  { transform: scaleY(1); transform-origin: top; }
  50%  { transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

@keyframes tickerMove {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}


/* ═══════════════════════════════════════
   REVEAL ON SCROLL
═══════════════════════════════════════ */

.reveal,
.reveal-left,
.reveal-right,
.reveal-scale {
  opacity: 0;
  transition:
    opacity var(--duration-reveal) var(--ease-out-expo),
    transform var(--duration-reveal) var(--ease-out-expo);
  will-change: opacity, transform;
}

.reveal       { transform: translateY(30px); }
.reveal-left  { transform: translateX(-30px); }
.reveal-right { transform: translateX(30px); }
.reveal-scale { transform: scale(0.95); }

.reveal.revealed,
.reveal-left.revealed,
.reveal-right.revealed,
.reveal-scale.revealed {
  opacity: 1;
  transform: translate(0) scale(1);
}

/* Stagger children */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity var(--duration-reveal) var(--ease-out-expo),
    transform var(--duration-reveal) var(--ease-out-expo);
}

.reveal-stagger.revealed > * {
  opacity: 1;
  transform: translateY(0);
}

.reveal-stagger.revealed > *:nth-child(1)  { transition-delay: 0ms; }
.reveal-stagger.revealed > *:nth-child(2)  { transition-delay: 80ms; }
.reveal-stagger.revealed > *:nth-child(3)  { transition-delay: 160ms; }
.reveal-stagger.revealed > *:nth-child(4)  { transition-delay: 240ms; }
.reveal-stagger.revealed > *:nth-child(5)  { transition-delay: 320ms; }
.reveal-stagger.revealed > *:nth-child(6)  { transition-delay: 400ms; }
.reveal-stagger.revealed > *:nth-child(7)  { transition-delay: 480ms; }
.reveal-stagger.revealed > *:nth-child(8)  { transition-delay: 560ms; }
.reveal-stagger.revealed > *:nth-child(9)  { transition-delay: 640ms; }
.reveal-stagger.revealed > *:nth-child(10) { transition-delay: 720ms; }


/* ═══════════════════════════════════════
   BACKGROUND CANVAS
═══════════════════════════════════════ */

#bgCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: var(--z-bg);
}


/* ═══════════════════════════════════════
   REDUCED MOTION
═══════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal, .reveal-left, .reveal-right, .reveal-scale {
    opacity: 1;
    transform: none;
    transition: none;
  }
}


/* ═══════════════════════════════════════
   CONTENT VISIBILITY — Performance
═══════════════════════════════════════ */

.lazy-section {
  content-visibility: auto;
  contain-intrinsic-size: auto 600px;
}


/* ═══════════════════════════════════════
   SOCIAL RAIL — barra fixa lateral discreta
═══════════════════════════════════════ */

.social-rail {
  position: fixed;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 90;
}

.social-rail-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(7, 7, 16, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition:
    color 0.25s var(--ease),
    border-color 0.25s var(--ease),
    background 0.25s var(--ease),
    transform 0.25s var(--ease);
  text-decoration: none;
}

.social-rail-btn:hover {
  color: var(--white);
  border-color: var(--purple-30);
  background: rgba(73, 36, 245, 0.18);
  transform: translateX(2px);
}

.social-rail-tooltip {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  background: rgba(7, 7, 16, 0.95);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}

.social-rail-btn:hover .social-rail-tooltip,
.social-rail-btn:focus-visible .social-rail-tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

@media (max-width: 900px) {
  .social-rail { display: none; }
}


/* ═══════════════════════════════════════
   ULTRA-WIDE SCREENS (1600px+)
═══════════════════════════════════════ */

@media (min-width: 1600px) {
  :root {
    --max-w: 1400px;
    --section-px: clamp(80px, 8vw, 160px);
    --text-hero: clamp(4rem, 5vw, 5.5rem);
    --text-h2: clamp(2.5rem, 3vw, 3.5rem);
    --text-h3: clamp(1.4rem, 1.8vw, 1.75rem);
    --text-body: clamp(1rem, 1vw, 1.125rem);
  }
}

@media (min-width: 2560px) {
  :root {
    --max-w: 1800px;
    --section-px: clamp(120px, 10vw, 240px);
    --text-hero: clamp(5rem, 4.5vw, 6.5rem);
    --text-h2: clamp(3rem, 3vw, 4rem);
    --text-h3: clamp(1.6rem, 1.8vw, 2rem);
    --text-body: clamp(1.05rem, 1vw, 1.2rem);
  }
}

/* Focus visible — WCAG 2.4.11 */
:focus-visible {
  outline: 2px solid #4924F5;
  outline-offset: 3px;
  border-radius: 4px;
}
/* Suprimir outline apenas quando não é teclado (cursor customizado ativo) */
:focus:not(:focus-visible) {
  outline: none;
}
