/* ===== Animated "system boot" intro (home page) ===== */
#intro {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center;
  background:
    radial-gradient(800px 500px at 50% 40%, rgba(17,84,255,.28), transparent 70%),
    #050816;
  color: #dbe6ff; overflow: hidden; cursor: pointer;
  font-family: Geist, ui-sans-serif, system-ui, sans-serif;
}
#intro::before { /* moving grid */
  content: ""; position: absolute; inset: -40px;
  background-image:
    linear-gradient(rgba(62,139,255,.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(62,139,255,.10) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: grid-drift 6s linear infinite;
  mask-image: radial-gradient(circle at 50% 45%, #000 30%, transparent 75%);
}
#intro::after { /* scanline sweep */
  content: ""; position: absolute; left: 0; right: 0; height: 140px; top: -140px;
  background: linear-gradient(transparent, rgba(62,139,255,.12), transparent);
  animation: scan 2.4s ease-in-out .2s;
}
@keyframes grid-drift { to { transform: translate(40px, 40px); } }
@keyframes scan { to { top: 110%; } }

.intro-stage { position: relative; width: min(92vw, 720px); text-align: center; }
.intro-brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; letter-spacing: .02em; color: #fff; opacity: 0; animation: fade-up .5s ease forwards .05s; }
.intro-brand img { width: 34px; height: 34px; display: block; filter: drop-shadow(0 0 14px rgba(62,139,255,.8)); }

/* Network diagram */
.intro-net { width: 100%; height: auto; margin: 26px 0 18px; overflow: visible; }
.intro-net .wire { stroke: rgba(62,139,255,.9); stroke-width: 2; fill: none; stroke-dasharray: 260; stroke-dashoffset: 260; filter: drop-shadow(0 0 6px rgba(62,139,255,.8)); }
.intro-net .w1 { animation: draw .55s ease-out forwards .55s; }
.intro-net .w2 { animation: draw .55s ease-out forwards 1.05s; }
.intro-net .node circle.ring { fill: #0b1230; stroke: #3e8bff; stroke-width: 2; }
.intro-net .node circle.core { fill: #3e8bff; }
.intro-net .node.you circle.ring { stroke: #fff; }
.intro-net .node.you circle.core { fill: #fff; }
.intro-net .node { opacity: 0; transform-box: fill-box; transform-origin: center; }
.intro-net .n1 { animation: pop .4s cubic-bezier(.2,1.4,.4,1) forwards .3s; }
.intro-net .n2 { animation: pop .4s cubic-bezier(.2,1.4,.4,1) forwards .75s; }
.intro-net .n3 { animation: pop .4s cubic-bezier(.2,1.4,.4,1) forwards 1.25s; }
.intro-net .pulse { fill: none; stroke: #3e8bff; stroke-width: 2; opacity: 0; transform-box: fill-box; transform-origin: center; animation: ping 1.4s ease-out infinite 1.4s; }
.intro-net text { fill: #8fb3ff; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-anchor: middle; }
.intro-net .node.you text { fill: #fff; }
.intro-net .packet { fill: #fff; filter: drop-shadow(0 0 6px #3e8bff); opacity: 0; }
.intro-net .money { fill: #4ade80; font-size: 15px; font-weight: 800; letter-spacing: 0; opacity: 0; animation: money 1s ease-out forwards 1.9s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.3); } to { opacity: 1; transform: scale(1); } }
@keyframes ping { 0% { opacity: .8; transform: scale(1); } 100% { opacity: 0; transform: scale(2.4); } }
@keyframes money { 0% { opacity: 0; transform: translateY(6px); } 30% { opacity: 1; } 100% { opacity: 1; transform: translateY(-14px); } }

/* Terminal */
.intro-term {
  text-align: left; margin: 0 auto; width: min(100%, 460px);
  font: 13px/1.75 ui-monospace, "SF Mono", Consolas, monospace; color: #9fb6e6;
  background: rgba(10,16,40,.7); border: 1px solid rgba(62,139,255,.25); border-radius: 12px;
  padding: 12px 16px; box-shadow: 0 0 40px -10px rgba(17,84,255,.5);
  opacity: 0; animation: fade-up .4s ease forwards .4s;
}
.intro-term div { white-space: nowrap; overflow: hidden; width: 0; }
.intro-term div::before { content: "> "; color: #3e8bff; }
.intro-term .ok { color: #4ade80; }
.intro-term .l1 { animation: type .45s steps(30) forwards .6s; }
.intro-term .l2 { animation: type .45s steps(30) forwards 1.05s; }
.intro-term .l3 { animation: type .45s steps(30) forwards 1.5s; }
.intro-term .l4 { animation: type .4s steps(26) forwards 1.95s; }
@keyframes type { to { width: 100%; } }

.intro-bar { width: min(100%, 460px); height: 3px; margin: 16px auto 0; border-radius: 3px; background: rgba(62,139,255,.18); overflow: hidden; }
.intro-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #3e8bff, #fff); box-shadow: 0 0 12px #3e8bff; animation: load 2.2s cubic-bezier(.4,0,.2,1) forwards .2s; }
@keyframes load { to { width: 100%; } }
.intro-skip { position: absolute; bottom: 22px; left: 0; right: 0; text-align: center; font-size: 12px; color: rgba(219,230,255,.45); letter-spacing: .08em; }

@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Exit: the overlay splits open like a shutter */
#intro.out { animation: intro-out .7s cubic-bezier(.7,0,.2,1) forwards; }
@keyframes intro-out {
  0% { clip-path: inset(0 0 0 0); }
  100% { clip-path: inset(50% 0 50% 0); opacity: .6; }
}

/* ===== Page entrance after the intro ===== */
.reveal-ready .rv { opacity: 0; transform: translateY(18px); }
.revealed .rv { animation: rv .7s cubic-bezier(.2,.8,.2,1) forwards; animation-delay: calc(var(--d, 0) * 90ms); }
@keyframes rv { to { opacity: 1; transform: none; } }
.revealed h1 .hl { animation: hl-wipe .8s cubic-bezier(.7,0,.2,1) .5s both; }
@keyframes hl-wipe { from { clip-path: inset(0 100% 0 0 round 16px); } to { clip-path: inset(0 0 0 0 round 16px); } }

@media (max-height: 560px) {
  .intro-skip { top: 14px; right: 18px; left: auto; bottom: auto; }
  .intro-net { margin: 14px 0 10px; }
}
@media (max-width: 560px) {
  .intro-net text { font-size: 11px; }
  .intro-term { font-size: 11.5px; }
}
@media (prefers-reduced-motion: reduce) {
  #intro { display: none !important; }
  .reveal-ready .rv { opacity: 1; transform: none; }
}
