/* ============================================================
   RIAWORKS — Hero "Arquipélago" · V1
   Fundo chapado #131517 na zona de arrasto (regra do alfa);
   vinheta só nas bordas externas. Luz = código, matéria = arte.
   ============================================================ */

:root {
  --bg: #131517;
  --ink: #f4f4f2;
  --ink-dim: #a9adb3;
  --orange: #fa5d19;
  --orange-soft: #ff8a4d;
  --line: #2a2d31;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  /* cor-base sólida (ponta escura do gradiente do body). Sem isso, quando a
     barra do browser recolhe no mobile a faixa recém-exposta aparece PRETA
     por um instante — o fundo `fixed` do body ainda não repintou. Com a base
     no html, essa faixa é sempre a cor do site (o "risco preto" some). */
  background: #0B0F12;
  /* trava o arrasto horizontal do viewport no mobile (iOS rubber-band
     acontece no nível do documento, não só no body). clip não cria
     contexto de rolagem — não afeta o sticky do trilho no desktop. */
  overflow-x: clip;
  overscroll-behavior-x: none;
}

body {
  background:
    radial-gradient(120% 100% at 80% 0%, #12191E 0%, #0B0F12 60%) fixed;
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  overscroll-behavior-x: none;
}

/* vinheta global apenas nas bordas extremas — longe do raio de arrasto */
body::after {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 40%, transparent 62%, rgba(0,0,0,0.42) 100%);
  z-index: 0;
}

/* ---------- header ---------- */
.site-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 1.4rem clamp(1.2rem, 4vw, 4rem);
}

.brand-logo { height: 40px; width: auto; display: block; }

/* no desktop o wrapper "some" do layout — nav + CTA participam direto do
   flex do header (comportamento idêntico ao anterior). No mobile ele vira
   o painel dropdown (ver media query). */
.nav-drawer { display: contents; }

.main-nav {
  display: flex;
  gap: 1.8rem;
  margin-left: auto;
}

.main-nav a {
  position: relative;
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.005em;
  white-space: nowrap;
  padding-block: 2px;
  transition: color .2s ease;
}
/* sublinhado laranja que "desenha" da esquerda — hover e página atual */
.main-nav a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -5px;
  height: 2px;
  background: var(--orange);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .28s cubic-bezier(.2,.7,.2,1);
}
.main-nav a:hover { color: var(--orange); }
.main-nav a:hover::after,
.main-nav a[aria-current="page"]::after { transform: scaleX(1); }
.main-nav a[aria-current="page"] { color: var(--orange); }

.btn-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  background: var(--orange);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  white-space: nowrap;
  transition: transform .2s ease, box-shadow .2s ease;
}
.btn-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(250,93,25,0.35);
}
.btn-cta .cta-arw { display: inline-block; transition: transform .2s ease; }
.btn-cta:hover .cta-arw { transform: translateX(3px); }

.nav-toggle { display: none; }

/* ---------- hero ---------- */
.hero {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(420px, 44%) 1fr;
  align-items: center;
  min-height: calc(100vh - 90px);
  padding: 0 clamp(1.2rem, 4vw, 4rem) 2rem;
  gap: 1rem;
}

.hero-copy { max-width: 620px; }

.kicker {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  color: var(--orange);
  margin-bottom: 1.6rem;
}

.hero-copy h1 {
  font-size: clamp(2.1rem, 3.4vw, 3.15rem);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.015em;
  margin-bottom: 1.4rem;
}
.hero-copy h1 .hl { color: var(--orange); }

.hero-copy .sub {
  color: var(--ink-dim);
  font-size: 1.02rem;
  line-height: 1.75;
  max-width: 54ch;
}

.scroll-cue {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-top: clamp(2.5rem, 7vh, 5rem);
}
.cue-line {
  width: 1px; height: 44px;
  background: linear-gradient(to bottom, transparent, var(--orange));
  animation: cue-pulse 2.6s ease-in-out infinite;
}
.cue-text {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  color: var(--ink-dim);
}
@keyframes cue-pulse {
  0%, 100% { opacity: .45; } 50% { opacity: 1; }
}

/* malha de engenharia — bem suave, só ao redor do arquipélago */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg,  rgba(255,255,255,0.028) 0 1px, transparent 1px 96px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.028) 0 1px, transparent 1px 96px),
    repeating-linear-gradient(0deg,  rgba(255,255,255,0.011) 0 1px, transparent 1px 16px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.011) 0 1px, transparent 1px 16px);
  -webkit-mask-image: radial-gradient(72% 78% at 66% 52%, #000 26%, transparent 74%);
          mask-image: radial-gradient(72% 78% at 66% 52%, #000 26%, transparent 74%);
  z-index: 0;
}

/* ---------- palco do arquipélago ---------- */
.hero-stage {
  position: relative;
  height: min(78vh, 760px);
  min-height: 480px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y; /* scroll vertical passa; drag horizontal é nosso */
}

.stage-halo {
  position: absolute;
  left: 50%; top: 52%;
  width: 68%; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle,
    rgba(250,93,25,0.13) 0%,
    rgba(250,93,25,0.05) 38%,
    transparent 68%);
  pointer-events: none;
}

#bridges {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  overflow: visible;
  pointer-events: none;
}

.bridge-glow {
  fill: none;
  stroke: var(--orange);
  stroke-width: 5;
  opacity: 0.12;
  filter: blur(6px);
  transition: opacity .25s ease;
}
.bridge-core {
  fill: none;
  stroke: url(#bridgeGrad);
  stroke-width: 1.4;
  opacity: 0.55;
  transition: opacity .25s ease, stroke-width .25s ease;
}
.bridge.active .bridge-core { opacity: 1; stroke-width: 2; }
.bridge.active .bridge-glow { opacity: 0.34; }

.pulse-dot { fill: #ffc49a; }
.pulse-halo { fill: var(--orange); opacity: .35; filter: blur(3px); }

/* ilha */
.island {
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: grab;
  will-change: transform;
  z-index: 2;
  -webkit-user-drag: none;
}
.island.dragging { cursor: grabbing; z-index: 5; }

.island img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 26px 30px rgba(0,0,0,0.55));
  transition: filter .25s ease;
}
.island:hover img,
.island.dragging img {
  filter: drop-shadow(0 34px 40px rgba(0,0,0,0.65))
          drop-shadow(0 0 26px rgba(250,93,25,0.28));
}

/* nome da ilha — embaixo, centralizado, limpo */
.island-name {
  position: absolute;
  top: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-family: var(--font-mono);   /* mesmo token do kicker */
  font-size: 0.6rem;               /* definido pelo dono */
  font-weight: 400;                /* mesmo peso do kicker */
  letter-spacing: 0.14em;          /* mesmo tracking do kicker */
  text-transform: uppercase;
  color: rgba(255,255,255,0.8);
  pointer-events: none;
  transition: color .25s ease;
}
.island:hover .island-name { color: #fff; }

.island--nucleo { cursor: default; }

/* ---------- responsivo ---------- */
/* menu com 6 itens: aperta o espaçamento antes do colapso (evita overflow 961–1100) */
@media (max-width: 1100px) and (min-width: 961px) {
  .site-header { gap: 1.1rem; }
  .main-nav { gap: 1.05rem; }
  .main-nav a { font-size: 0.84rem; }
}

@media (max-width: 960px) {
  /* header colapsado: só logo + hambúrguer. O CTA "Falar com a Riaworks"
     sai do header (ficava desproporcional à logo) e reaparece dentro do
     menu aberto, para o contato não sumir. */
  .nav-drawer { display: none; }

  .nav-toggle {
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    gap: 5px;
    margin-left: auto;            /* encosta à direita, com respiro do padding */
    width: 44px; height: 44px;    /* alvo de toque confortável e clicável */
    background: none; border: 0; padding: 0; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .nav-toggle span {
    display: block; width: 24px; height: 2px;
    background: var(--ink); border-radius: 2px;
    transition: transform .25s ease, opacity .18s ease;
  }
  /* barrinhas viram "X" quando o menu está aberto */
  .site-header.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .site-header.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
  .site-header.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* painel dropdown do menu aberto */
  .site-header.nav-open .nav-drawer {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: #0d1215;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding: 0.4rem clamp(1.2rem, 4vw, 4rem) 1.1rem;
    z-index: 20;
    box-shadow: 0 20px 44px rgba(0,0,0,0.5);
  }
  .site-header.nav-open .main-nav {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-left: 0;
  }
  .site-header.nav-open .main-nav a {
    padding: 0.9rem 0;
    font-size: 1rem;
    color: var(--ink);
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }
  .site-header.nav-open .main-nav a::after { display: none; }
  .site-header.nav-open .btn-cta {
    justify-content: center;
    margin-top: 1rem;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: unset;
    padding-top: 1.5rem;
  }
  .hero-copy h1 { font-size: clamp(1.9rem, 7.2vw, 2.4rem); }
  /* Palco mais baixo p/ caber no retrato; drag desligado no touch, então o
     palco não intercepta nada — a rolagem passa livre.
     `svh` (small viewport height) é ESTÁVEL: não cresce quando a barra do
     browser recolhe, então as ilhas não se "esticam" no meio da rolagem.
     max-height limita o tamanho do canvas das ilhas. `vh` fica de fallback. */
  .hero-stage {
    height: 56vh;
    height: 56svh;
    min-height: 400px;
    max-height: 600px;
    margin-top: 0.5rem;
    touch-action: auto;
  }
  .scroll-cue { display: none; }
  .hero-stage + .scroll-cue-mobile { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
  .cue-line { animation: none; }
}
