/* ============================================================
   PORTFÓLIO v2 "EMBER" — CORE CSS (núcleo, só leitura p/ secções)
   ============================================================ */

/* ---------- Design tokens (CONTRATO.md) ---------- */
:root {
  --bg: #07070d;
  --bg-2: #0d0d18;
  --ink: #e9e9f2;
  --ink-dim: #9a9ab0;
  --ember: #7c3aed;
  --amber: #22d3ee;
  --grad-fire: linear-gradient(120deg, #7c3aed, #06b6d4 60%, #22d3ee);
  --display: 'Archivo Black', sans-serif;   /* títulos gigantes, uppercase */
  --body: 'Space Grotesk', sans-serif;
  --mono: 'JetBrains Mono', monospace;

  /* tokens auxiliares (derivados da paleta) */
  --border: rgba(255, 255, 255, 0.12);
  --border-soft: rgba(255, 255, 255, 0.08);
  --z-nav: 100;
  --z-fuse: 900;
  --z-noise: 950;
  --z-cursor: 1000;
  --z-ignition: 9999;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-weight: 400;
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

img,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

::selection {
  background: var(--ember);
  color: var(--bg);
}

/* ---------- Textura de ruído (feTurbulence) ---------- */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: var(--z-noise);
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
}

/* ---------- Cursor custom ---------- */
@media (pointer: fine) {
  body,
  a,
  button,
  [data-cursor="hover"] {
    cursor: none;
  }
}

.cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 8px;
  height: 8px;
  background: var(--ember);
  border-radius: 50%;
  pointer-events: none;
  z-index: var(--z-cursor);
  transform: translate(-50%, -50%);
}

.cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  width: 36px;
  height: 36px;
  border: 1px solid var(--ember);
  border-radius: 50%;
  pointer-events: none;
  z-index: var(--z-cursor);
  transform: translate(-50%, -50%);
  transition:
    width 0.25s ease,
    height 0.25s ease,
    background-color 0.25s ease,
    opacity 0.25s ease;
}

.cursor-ring.is-hover {
  width: 64px;
  height: 64px;
  background-color: rgba(124, 58, 237, 0.15);
}

@media (pointer: coarse) {
  .cursor,
  .cursor-ring {
    display: none;
  }

  body {
    cursor: auto;
  }
}

/* ---------- Fuse (rastilho / progresso de scroll) ---------- */
.fuse {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  width: 0%;
  background: var(--grad-fire);
  z-index: var(--z-fuse);
  pointer-events: none;
}

.fuse__tip {
  position: absolute;
  right: -3px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
  transform: translateY(-50%);
  box-shadow: 0 0 12px 4px var(--ember);
}

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-nav);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 16px;
  padding: 16px clamp(20px, 5vw, 64px);
  border-bottom: 1px solid var(--border-soft);
  background: transparent;
  transition: background-color 0.3s ease, backdrop-filter 0.3s ease;
}

.nav--scrolled {
  background: rgba(7, 7, 13, 0.72);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.nav__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.08em;
  color: var(--ink);
}

.nav__logo-mark {
  height: 46px;
  width: auto;
}

.nav__dot {
  color: var(--ember);
}

.nav__links {
  display: flex;
  gap: clamp(16px, 3vw, 40px);
}

.nav__links a {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  color: var(--ink-dim);
  transition: color 0.2s ease;
}

.nav__links a:hover {
  color: var(--ember);
}

/* Mobile: logo em cima, links numa linha por baixo */
@media (max-width: 560px) {
  .nav {
    flex-direction: column;
    align-items: flex-start;
    padding-block: 12px;
  }

  .nav__links {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }
}

/* ---------- Ignição (overlay de intro) ---------- */
#ignition {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: var(--z-ignition);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  transition:
    transform 0.9s cubic-bezier(0.76, 0, 0.24, 1),
    visibility 0s linear 0.9s;
}

#ignition .ignition__logo {
  height: clamp(84px, 16vw, 136px);
  width: auto;
  opacity: 0;
  transform: scale(0.92);
  filter: drop-shadow(0 0 26px rgba(46, 212, 250, 0.45));
  transition: opacity 0.5s ease, transform 0.5s ease;
}

#ignition .ignition__logo.is-lit {
  opacity: 1;
  transform: none;
}

#ignition .ignition__text {
  font-family: var(--mono);
  font-size: clamp(0.85rem, 2.2vw, 1.05rem);
  color: var(--ink-dim);
  white-space: pre-line;
  line-height: 2;
  padding-inline: 24px;
}

#ignition .ignition__text .ignition__line--last {
  color: var(--ember);
}

#ignition.is-done {
  transform: translateY(-100%);
  visibility: hidden;
}

/* ---------- Main / footer ---------- */
main {
  position: relative;
}

.footer {
  padding: 40px clamp(20px, 5vw, 64px);
  border-top: 1px solid var(--border-soft);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  text-align: center;
}

.footer__logo {
  height: 28px;
  width: auto;
  margin: 0 auto 14px;
  opacity: 0.85;
}

/* ---------- Utilitários globais ---------- */
.container {
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: clamp(20px, 5vw, 64px);
}

.label-mono {
  font-family: var(--mono);
  color: var(--ember);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* .is-visible — hook de reveal: cada secção define a sua própria transição */
.is-visible {
  /* intencionalmente vazio no núcleo */
}

/* ---------- Scrollbar custom ---------- */
html {
  scrollbar-color: var(--ink-dim) var(--bg-2);
  scrollbar-width: thin;
}

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-2);
}

::-webkit-scrollbar-thumb {
  background: var(--ink-dim);
  border-radius: 5px;
  border: 2px solid var(--bg-2);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ember);
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }

  html {
    scroll-behavior: auto;
  }

  #ignition {
    display: none;
  }
}
