/* ━━━━━━━━━━━━━━━━━ AGENTES MONTANDO O LAYOUT ━━━━━━━━━━━━━━━━━
   Ativo só quando <html> tem .ag-on (setado no <head> antes do primeiro paint).
   A lista de seletores abaixo precisa bater com LAYERS em agents.js. */

/* Desliga as entradas originais (reveal, keyframes do hero): quem revela agora são os agentes.
   :where() mantém a especificidade baixa para os :hover continuarem vencendo. */
:where(html.ag-on) :is(.reveal, .tl-item, .proj, .skill-card, .social-card, .hero-eyebrow, .hero-h1,
  .hero-desc, .hero-actions, .hero-code, .hero-right) {
  opacity: 1;
  transform: none;
  animation: none;
  transition-property: background-color, border-color, box-shadow, color, transform;
}

/* Camadas ainda não montadas ficam invisíveis, mas ocupam espaço (sem layout shift). */
html.ag-on :is(.hero-eyebrow, .hero-h1, .hero-desc, .hero-actions .btn, .hero-code, .avatar-wrap,
  .sec-label, .sec-title, #skills-intro > p, .about-text p, .stat, .svc, .skill-card, .tl-item,
  .proj, .contact-big, .contact-sub, .contact-link, #blog-latest .btn, .social-sub, .social-card,
  footer p):not(.ag-done) {
  opacity: 0 !important;
}

html.ag-on .ag-done { animation: agIn .6s cubic-bezier(.2, .7, .2, 1) backwards; }
@keyframes agIn {
  from { opacity: 0; clip-path: inset(0 100% 0 0); filter: blur(6px); }
  to   { opacity: 1; clip-path: inset(0); filter: none; }
}

/* ── palco: coordenadas do documento, cresce junto com a página ── */
.ag-stage {
  position: absolute; left: 0; top: 0; width: 100%; height: 0;
  z-index: 600; pointer-events: none;
}
.ag-stage.ag-hidden { display: none; }

/* ── cursor de agente ── */
.ag-cur {
  position: absolute; left: 0; top: 0;
  opacity: 0; will-change: transform;
}
.ag-cur.ag-live { opacity: 1; }
.ag-cur svg {
  display: block; width: 15px; height: 19px;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, .55));
}
.ag-cur.ag-click svg { animation: agClick .22s ease; }
@keyframes agClick { 50% { transform: scale(.8); } }
.ag-tag {
  position: absolute; left: 13px; top: 15px;
  font: 500 9px/1 'JetBrains Mono', monospace; letter-spacing: .04em;
  padding: 3px 5px; border-radius: 3px; white-space: nowrap;
  background: var(--c); color: #060810;
  opacity: .9;
}

/* ── caixa de seleção (wireframe) ── */
.ag-box {
  position: absolute; width: 0; height: 0;
  border: 1px solid var(--accent);
  background: rgba(0, 229, 176, .035);
}
.ag-box > i {
  position: absolute; width: 6px; height: 6px;
  background: var(--bg); border: 1px solid var(--accent);
}
.ag-box > i:nth-child(1) { left: -3.5px;  top: -3.5px; }
.ag-box > i:nth-child(2) { right: -3.5px; top: -3.5px; }
.ag-box > i:nth-child(3) { left: -3.5px;  bottom: -3.5px; }
.ag-box > i:nth-child(4) { right: -3.5px; bottom: -3.5px; }
.ag-dim {
  position: absolute; left: 50%; top: calc(100% + 6px); transform: translateX(-50%);
  font: 500 9px/1 'JetBrains Mono', monospace; white-space: nowrap;
  padding: 3px 5px; border-radius: 2px;
  background: var(--accent); color: #060810;
}
/* fase "rascunho": bloco cinza antes do conteúdo real */
.ag-box.ag-sk {
  background: linear-gradient(100deg, rgba(255,255,255,.05) 30%, rgba(255,255,255,.11) 50%, rgba(255,255,255,.05) 70%);
  background-size: 300% 100%;
  animation: agShimmer .7s linear infinite;
}
@keyframes agShimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.ag-box.ag-out { opacity: 0; transition: opacity .5s ease; }
/* inspeção ociosa: agente "revisando" algo já pronto */
.ag-box.ag-peek {
  border-style: dashed; border-color: rgba(108, 95, 255, .7); background: none;
  transition: opacity .4s ease;
}
.ag-box.ag-peek > i { border-color: var(--accent2); }
.ag-box.ag-peek .ag-dim { background: var(--accent2); color: #fff; }

/* ── HUD ── */
.ag-hud {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  z-index: 650;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px 8px 14px;
  background: rgba(11, 14, 24, .82); backdrop-filter: blur(14px);
  border: 1px solid var(--border); border-radius: 999px;
  font: 400 .68rem/1 'JetBrains Mono', monospace; color: var(--muted);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
  opacity: 0; animation: fadeIn .6s ease .3s forwards;
}
.ag-hud b { color: var(--text); font-weight: 500; }
.ag-dots { display: flex; gap: 3px; }
.ag-dots i {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255, 255, 255, .15); transition: background .25s;
}
.ag-dots i.on { background: var(--accent); box-shadow: 0 0 6px var(--glow); }
.ag-bar { width: 70px; height: 2px; background: rgba(255, 255, 255, .08); border-radius: 2px; overflow: hidden; }
.ag-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s ease; }
.ag-hud button {
  font: inherit; color: var(--text); cursor: pointer;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 9px;
  transition: border-color .2s, color .2s;
}
.ag-hud button:hover { border-color: var(--accent); color: var(--accent); }
.ag-hud button.ag-primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.ag-hud.ag-mini > :not([data-act="toggle"]) { display: none; }
.ag-hud.ag-mini { padding: 6px; gap: 0; }

@media (max-width: 760px) {
  .ag-tag, .ag-bar, .ag-dots { display: none; }
  .ag-hud { bottom: 12px; gap: 8px; }
}
