/* ============ AI AGENT BUILD OVERLAY ============ */
.ag-boot .nav, .ag-boot main, .ag-boot footer { visibility: hidden; }
.ag-hide { opacity: 0 !important; }
.ag-building .loader { display: none; }

.ag-layer { position: fixed; inset: 0; z-index: 900; pointer-events: none; overflow: hidden; opacity: 0; transition: opacity .4s; font-family: var(--body, Inter, sans-serif); }
.ag-layer.is-in { opacity: 1; }
.ag-layer.is-out { opacity: 0; transition: opacity .6s; }
.ag-ghosts, .ag-fx, .ag-agents { position: absolute; inset: 0; }

/* rulers + guides */
.ag-ruler { position: absolute; background-color: rgba(10, 18, 34, .85); opacity: 0; transition: opacity .5s, transform .6s cubic-bezier(.22,1,.36,1); }
.ag-ruler--top {
  top: 0; left: 0; right: 0; height: 16px; transform: translateY(-100%);
  background-image:
    linear-gradient(90deg, rgba(120,170,255,.75) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120,170,255,.4) 1px, transparent 1px);
  background-size: 100px 100%, 10px 6px; background-repeat: repeat-x; background-position: 0 0, 0 100%;
  border-bottom: 1px solid rgba(120,170,255,.35);
}
.ag-ruler--left {
  top: 0; bottom: 0; left: 0; width: 16px; transform: translateX(-100%);
  background-image:
    linear-gradient(rgba(120,170,255,.75) 1px, transparent 1px),
    linear-gradient(rgba(120,170,255,.4) 1px, transparent 1px);
  background-size: 100% 100px, 6px 10px; background-repeat: repeat-y; background-position: 0 0, 100% 0;
  border-right: 1px solid rgba(120,170,255,.35);
}
.ag-guide { position: absolute; top: 0; bottom: 0; left: var(--pad, 48px); width: 1px; background: #e5322d; box-shadow: 0 0 8px #e5322d; opacity: 0; transition: opacity .6s; }
.ag-scan { position: absolute; left: 0; right: 0; top: 0; height: 1px; background: linear-gradient(90deg, transparent, #4f9bff 15%, #4f9bff 85%, transparent); box-shadow: 0 0 14px #4f9bff; opacity: 0; }
.ag-scan span { position: absolute; left: 50%; top: -9px; transform: translateX(-50%); font-size: 10px; line-height: 1; padding: 4px 7px; background: #2f7bff; color: #fff; border-radius: 3px; white-space: nowrap; }
.is-blueprint .ag-ruler { opacity: 1; transform: none; }
.is-blueprint .ag-guide { opacity: .7; }

.ag-logo { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-family: var(--display, Anton, sans-serif); font-size: 72px; color: #2b2b30; transition: opacity .5s, transform .6s; }
.ag-logo span { color: #5a1513; }
.is-scanned .ag-logo { opacity: 0; transform: translate(-50%, -50%) scale(.6); }

/* ghosts (blueprint boxes) */
.ag-ghost, .ag-drop { position: absolute; left: 0; top: 0; will-change: transform; }
.ag-ghost {
  --c: #4f9bff;
  background: rgba(64, 140, 255, .1);
  border: 1px solid rgba(110, 170, 255, .45);
  border-radius: 2px;
  opacity: 0;
  transition: opacity .35s, background .3s, border-color .25s;
}
.is-blueprint .ag-ghost { opacity: 1; }
.ag-drop { border: 1px dashed rgba(110, 170, 255, .45); border-radius: 3px; opacity: 0; transition: opacity .3s; }
.is-blueprint .ag-drop { opacity: 1; }
.ag-ghost.is-drag { background: rgba(80, 150, 255, .2); box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .8); }
.ag-ghost.is-target { border-color: var(--c); }
.ag-ghost.is-active { border: 1.5px solid var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.ag-ghost.is-typing { background: transparent; }
.ag-ghost.is-dropped { background: transparent; }
.ag-ghost.is-done, .ag-drop.is-done { opacity: 0 !important; transition: opacity .4s; }

.ag-ghost .h { position: absolute; width: 7px; height: 7px; background: #0a0a0b; border: 1.5px solid var(--c); display: none; }
.ag-ghost .tl { left: -4px; top: -4px; } .ag-ghost .tr { right: -4px; top: -4px; }
.ag-ghost .bl { left: -4px; bottom: -4px; } .ag-ghost .br { right: -4px; bottom: -4px; }
.ag-ghost.is-active .h { display: block; }

/* alignment guides from the active element */
.ag-ghost.is-active::before, .ag-ghost.is-active::after { content: ""; position: absolute; background: var(--c); opacity: .22; }
.ag-ghost.is-active::before { left: -100vw; right: -100vw; top: -1px; height: 1px; }
.ag-ghost.is-active::after { top: -100vh; bottom: -100vh; left: -1px; width: 1px; }

.ag-tag { position: absolute; left: -1px; top: 100%; margin-top: 4px; font: 500 10px/1 var(--body, Inter, sans-serif); letter-spacing: .02em; padding: 3px 5px; background: #2f7bff; color: #fff; border-radius: 2px; white-space: nowrap; }
.ag-tag em { font-style: normal; opacity: .7; margin-left: 4px; }
.ag-ghost.is-small .ag-tag { display: none; }
.ag-ghost.is-active .ag-tag { display: block; background: var(--c); color: #0a0a0b; }
.ag-caret { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--c); box-shadow: 0 0 8px var(--c); display: none; left: 0; }
.ag-ghost.is-typing .ag-caret { display: block; animation: ag-blink .5s steps(2) infinite; }
@keyframes ag-blink { 50% { opacity: .3; } }

/* agents */
.ag-agent { position: absolute; left: 0; top: 0; margin: -3px 0 0 -4px; will-change: transform; filter: drop-shadow(0 0 6px var(--c)) drop-shadow(0 2px 2px rgba(0,0,0,.6)); }
.ag-agent svg { display: block; }
.ag-agent path { fill: var(--c); stroke: rgba(255,255,255,.85); stroke-width: 1.1; stroke-linejoin: round; }
.ag-layer.is-leaving .ag-agent { opacity: 0; transition: opacity 1.4s .3s; }

.ag-plus { position: absolute; transform: translate(-50%, -50%); color: #cfe0ff; font: 300 22px/1 var(--body, Inter, sans-serif); text-shadow: 0 0 8px #4f9bff; animation: ag-plus .9s ease-out forwards; }
@keyframes ag-plus { 0% { opacity: 0; transform: translate(-50%,-50%) scale(.3) rotate(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%,-50%) scale(1.3) rotate(90deg); } }

/* HUD */
.ag-hud {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 1001;
  display: flex; align-items: center; gap: 12px; padding: 7px 8px 7px 12px;
  background: rgba(16, 16, 20, .88); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.1); border-radius: 12px; box-shadow: 0 20px 50px -10px rgba(0,0,0,.7);
  font: 500 12px/1 var(--body, Inter, sans-serif); color: #d8d5cf; white-space: nowrap;
  animation: ag-hud-in .6s cubic-bezier(.22,1,.36,1);
  transition: opacity .5s, transform .5s;
}
@keyframes ag-hud-in { from { opacity: 0; transform: translate(-50%, 20px); } }
.ag-hud.is-out { opacity: 0; transform: translate(-50%, 20px); }
.ag-hud__avatars { display: flex; }
.ag-hud__avatars i { width: 14px; height: 14px; border-radius: 50%; background: var(--c); border: 2px solid #141418; margin-left: -5px; }
.ag-hud__avatars i:first-child { margin-left: 0; }
.ag-hud__status em { font-style: normal; animation: ag-blink 1s steps(2) infinite; }
.ag-hud__status b, .ag-hud__stat b { color: #fff; font-variant-numeric: tabular-nums; }
.ag-hud__stat { color: #8d8a85; }
.ag-hud__bar { width: 80px; height: 3px; border-radius: 3px; background: rgba(255,255,255,.1); overflow: hidden; }
.ag-hud__bar i { display: block; height: 100%; background: linear-gradient(90deg, #4f9bff, #e5322d); transform-origin: left; transform: scaleX(0); transition: transform .3s; }
.ag-hud button { padding: 6px 10px; border-radius: 7px; background: rgba(255,255,255,.07); color: #d8d5cf; font: 600 11px/1 var(--body, Inter, sans-serif); cursor: pointer; border: 0; transition: background .2s, color .2s; }
.ag-hud button:hover { background: rgba(255,255,255,.16); color: #fff; }
.ag-hud button.is-on { background: #2f7bff; color: #fff; }
.ag-hud button[hidden] { display: none; }
.ag-hud.is-done .ag-hud__stat, .ag-hud.is-done .ag-hud__bar, .ag-hud.is-done [data-act="tour"],
.ag-hud.is-done [data-act="speed"], .ag-hud.is-done [data-act="pause"] { display: none; }
.ag-hud.is-done [data-act="replay"] { background: #2f7bff; color: #fff; }

/* replay link in footer */
.ag-replay { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted, #8d8a85); padding: 0; transition: color .3s; }
.ag-replay:hover { color: #fff; }
.ag-replay i { font-style: normal; color: var(--red, #e5322d); }

@media (max-width: 760px) {
  .ag-ruler, .ag-guide { display: none; }
  .ag-hud { gap: 8px; bottom: 12px; padding: 6px 6px 6px 10px; max-width: calc(100vw - 24px); }
  .ag-hud__avatars, .ag-hud__bar, .ag-hud [data-act="pause"], .ag-hud:not(.is-done) .ag-hud__status { display: none; }
  .ag-tag { display: none !important; }
}

/* helpers tucked into the lead cursor while idle */
.ag-agent { transition: opacity .35s; }
.ag-agent.is-parked { opacity: 0; }

/* main menu open: show the menu fully and hide the build overlay (the build continues behind it) */
html.menu-open .nav .ag-hide { opacity: 1 !important; }
html.menu-open .ag-layer, html.menu-open .ag-hud { opacity: 0 !important; visibility: hidden; }
.nav .menu__item.is-open .ag-hide, .nav .mega .ag-hide { opacity: 1 !important; }

/* build progress bar removed: the build still runs; Esc skips it; footer link replays it */
.ag-hud { display: none !important; }
