/* Lunfin — custom styles (complements Tailwind) */

:root {
  --brand: #0052ff;
  --brand-dark: #0038b8;
  --ink: #050d2b;
  --ink-2: #0a1540;
}

html { scroll-behavior: smooth; }
section[id], form[id] { scroll-margin-top: 80px; }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

/* Hero background */
.hero-bg {
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(0, 82, 255, 0.16), transparent 60%),
    radial-gradient(700px 400px at 90% 10%, rgba(0, 82, 255, 0.10), transparent 60%),
    linear-gradient(180deg, #ffffff 0%, #f5f8ff 100%);
}
.grid-bg {
  background-image:
    linear-gradient(to right, rgba(0, 82, 255, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 82, 255, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 40%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 40%, transparent 75%);
}

/* Logo marquee */
.marquee { overflow: hidden; mask-image: linear-gradient(90deg, transparent, black 10%, black 90%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, black 10%, black 90%, transparent); }
.marquee-track { display: flex; width: max-content; animation: marquee 40s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* Live dot */
.live-dot { position: relative; display: inline-block; width: 8px; height: 8px; border-radius: 9999px; background: #22c55e; }
.live-dot::after { content: ""; position: absolute; inset: -4px; border-radius: 9999px; border: 2px solid rgba(34, 197, 94, 0.6); animation: ping 1.6s cubic-bezier(0, 0, 0.2, 1) infinite; }
@keyframes ping { 0% { transform: scale(0.6); opacity: 1; } 100% { transform: scale(1.6); opacity: 0; } }

/* Router simulation */
.router {
  background:
    radial-gradient(700px 300px at 50% 0%, rgba(0, 82, 255, 0.28), transparent 70%),
    linear-gradient(180deg, var(--ink-2) 0%, var(--ink) 100%);
}
.router-dots { background-image: radial-gradient(rgba(255,255,255,0.08) 1px, transparent 1px); background-size: 22px 22px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; }

.r-card { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.10); border-radius: 14px; transition: border-color .4s, box-shadow .4s, background .4s, transform .4s; }
.r-card.active { border-color: rgba(0, 82, 255, 0.9); box-shadow: 0 0 0 1px rgba(0,82,255,.5), 0 0 40px rgba(0,82,255,.35); background: rgba(0,82,255,0.10); }
.r-card.success { border-color: rgba(34,197,94,.9); box-shadow: 0 0 0 1px rgba(34,197,94,.5), 0 0 40px rgba(34,197,94,.3); background: rgba(34,197,94,.08); }
.r-card.fail { border-color: rgba(239,68,68,.9); box-shadow: 0 0 0 1px rgba(239,68,68,.5), 0 0 30px rgba(239,68,68,.25); background: rgba(239,68,68,.08); }
.r-card.dim { opacity: .45; }

.r-enter { animation: r-enter .5s cubic-bezier(.2,.8,.2,1) both; }
@keyframes r-enter { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

.signal-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; font-size: 12px; color: rgba(255,255,255,.75); }
.signal-row .s-dot { width: 6px; height: 6px; border-radius: 9999px; background: rgba(255,255,255,.25); transition: background .3s, box-shadow .3s; }
.signal-row.on .s-dot { background: #4f83ff; box-shadow: 0 0 10px #4f83ff; }
.signal-row .s-val { color: rgba(255,255,255,.35); min-width: 32px; text-align: right; }
.signal-row.on .s-val { color: #86efac; }

.cand-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; font-size: 12px; color: rgba(255,255,255,.8); opacity: 0; transform: translateX(-6px); transition: opacity .35s, transform .35s, background .35s; }
.cand-row.show { opacity: 1; transform: none; }
.cand-row.pick { background: rgba(0,82,255,.25); color: #fff; }
.cand-row .c-score { margin-left: auto; font-variant-numeric: tabular-nums; }

.bar { height: 3px; background: rgba(255,255,255,.1); border-radius: 9999px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #0052ff, #4f83ff); border-radius: 9999px; transition: width .6s ease; }
.r-card.success .bar > i { background: linear-gradient(90deg, #16a34a, #4ade80); }
.r-card.fail .bar > i { background: linear-gradient(90deg, #dc2626, #f87171); }

#router-svg path { fill: none; stroke: rgba(255,255,255,.12); stroke-width: 1.5; transition: stroke .4s, stroke-width .4s; }
#router-svg path.lit { stroke: rgba(0,82,255,.9); stroke-width: 2; filter: drop-shadow(0 0 6px rgba(0,82,255,.8)); }
#router-svg path.lit-green { stroke: rgba(34,197,94,.9); stroke-width: 2; filter: drop-shadow(0 0 6px rgba(34,197,94,.8)); }
#router-svg path.lit-red { stroke: rgba(239,68,68,.9); stroke-width: 2; filter: drop-shadow(0 0 6px rgba(239,68,68,.8)); }
#router-svg circle.pulse { fill: #fff; filter: drop-shadow(0 0 8px #4f83ff); }

.log-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .35; transition: opacity .4s; }
.log-line:first-child { opacity: 1; }
.log-line:nth-child(2) { opacity: .7; }
.log-line:nth-child(3) { opacity: .5; }

/* Orchestration flow */
.flow-card { position: relative; }
.flow-arrow { width: 2px; height: 28px; margin: 0 auto; background: linear-gradient(180deg, rgba(0,82,255,.1), rgba(0,82,255,.6)); position: relative; }
.flow-arrow::after { content: ""; position: absolute; left: 50%; bottom: -2px; width: 8px; height: 8px; border-right: 2px solid var(--brand); border-bottom: 2px solid var(--brand); transform: translateX(-50%) rotate(45deg); }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }

/* Code block */
.code { background: var(--ink); color: #e2e8f0; }
.code .k { color: #93c5fd; } .code .s { color: #86efac; } .code .c { color: #64748b; } .code .f { color: #c4b5fd; } .code .n { color: #fcd34d; }

/* Stat count */
.tabular { font-variant-numeric: tabular-nums; }

/* Button glow */
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 8px 24px -8px rgba(0,82,255,.6); transition: background .2s, transform .2s, box-shadow .2s; }
.btn-primary:hover { background: var(--brand-dark); transform: translateY(-1px); box-shadow: 0 12px 28px -8px rgba(0,82,255,.7); }

@media (prefers-reduced-motion: reduce) {
  .marquee-track { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .live-dot::after { animation: none; }
}
