html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in oklab, var(--brand) 45%, transparent) transparent;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--background); }
::-webkit-scrollbar-thumb {
  background: color-mix(in oklab, var(--brand) 40%, transparent);
  border-radius: 8px;
  border: 2px solid var(--background);
}
::-webkit-scrollbar-thumb:hover { background: color-mix(in oklab, var(--brand) 65%, transparent); }

@media (scripting: none) {
  .public-reveal, .hero-stagger { opacity: 1 !important; transform: none !important; }
}

.public-reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.public-reveal.is-visible { opacity: 1; transform: none; }

.hero-stagger {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1) var(--d, 0ms), transform 0.9s cubic-bezier(0.22, 1, 0.36, 1) var(--d, 0ms);
}
.hero-stagger.is-visible { opacity: 1; transform: none; }

#bh-canvas { width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 900ms ease; }
#bh-canvas.ready { opacity: 1; }

#site-header .public-reveal { transition-duration: 0.6s; }

/* ---------- demo console ---------- */
.demo {
  position: relative;
  overflow: hidden;
  container-type: inline-size;
  background: #0b0d13;
  color: #d4d4d8;
  display: flex;
  font-size: clamp(7px, 1.35cqw, 14px);
  user-select: none;
}
.demo-side {
  width: 17%;
  min-width: 90px;
  border-right: 1px solid #ffffff14;
  background: #0e1118;
  display: flex;
  flex-direction: column;
  padding: 1.4em 1em;
  gap: 1.6em;
}
.demo-brand { display: flex; align-items: center; gap: 0.6em; font-weight: 700; color: #fafafa; font-size: 1.15em; }
.demo-nav { display: flex; flex-direction: column; gap: 0.35em; }
.demo-nav-item {
  display: flex; align-items: center; gap: 0.7em;
  padding: 0.55em 0.8em; border-radius: 0.6em; color: #a1a1aa;
  transition: background 0.3s, color 0.3s;
}
.demo-nav-item i { width: 0.55em; height: 0.55em; border-radius: 2px; background: currentColor; opacity: 0.6; }
.demo-nav-item b { font-weight: 500; }
.demo-nav-item.active { background: #ffffff12; color: #fafafa; }
.demo-nav-item.active i { background: linear-gradient(135deg, #59dbee, #fc73bf); opacity: 1; }
.demo-side-foot { margin-top: auto; display: flex; align-items: center; gap: 0.6em; color: #71717a; font-size: 0.9em; }
.demo-dot { width: 0.6em; height: 0.6em; border-radius: 50%; background: #34d399; box-shadow: 0 0 8px #34d39988; animation: demo-pulse 2s ease infinite; }
@keyframes demo-pulse { 50% { opacity: 0.45; } }

.demo-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.demo-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1em 1.6em; border-bottom: 1px solid #ffffff10;
}
.demo-title { font-weight: 600; color: #fafafa; font-size: 1.1em; }
.demo-top-right { display: flex; align-items: center; gap: 1em; color: #71717a; }
#demo-clock { font-variant-numeric: tabular-nums; }
.demo-pill {
  padding: 0.3em 0.9em; border-radius: 999px; font-size: 0.85em;
  background: #59dbee1a; color: #59dbee; border: 1px solid #59dbee33;
}
.demo-scenes { position: relative; flex: 1; min-height: 0; }
.demo-scene {
  position: absolute; inset: 0; padding: 1.4em 1.6em;
  opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: opacity 0.5s ease, transform 0.5s ease, visibility 0.5s;
}
.demo-scene.active { opacity: 1; visibility: visible; transform: none; }

.demo-models { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1em; height: 100%; align-content: start; }
.demo-model {
  border: 1px solid #ffffff12; border-radius: 0.8em; background: #11141c;
  padding: 1em 1.1em; display: flex; flex-direction: column; gap: 0.5em;
  transition: border-color 0.4s, box-shadow 0.4s;
}
.demo-model.hot { border-color: #59dbee55; box-shadow: 0 0 24px -12px #59dbee66; }
.demo-model-name { color: #fafafa; font-weight: 600; font-family: ui-monospace, monospace; font-size: 0.95em; }
.demo-model-meta { display: flex; justify-content: space-between; color: #71717a; font-size: 0.85em; }
.demo-model-health { display: flex; align-items: center; gap: 0.45em; color: #34d399; font-size: 0.8em; }
.demo-model-health i { width: 0.5em; height: 0.5em; border-radius: 50%; background: currentColor; }
.demo-model-health.warn { color: #fbbf24; }

.demo-route { display: flex; align-items: center; gap: 2em; height: 78%; }
.demo-req {
  flex: 1.1; border: 1px solid #ffffff14; background: #11141c; border-radius: 0.8em;
  padding: 1.1em 1.2em; display: flex; flex-direction: column; gap: 0.6em;
}
.demo-req-label { color: #71717a; font-size: 0.85em; }
.demo-req code { color: #59dbee; font-family: ui-monospace, monospace; font-size: 0.9em; }
.demo-req-model { color: #a1a1aa; font-family: ui-monospace, monospace; font-size: 0.85em; }
.demo-gw {
  display: flex; flex-direction: column; align-items: center; gap: 0.6em;
  color: #fafafa; font-weight: 600; position: relative; padding: 0 0.4em;
}
.demo-gw::before, .demo-gw::after {
  content: ""; position: absolute; top: 50%; height: 1px; width: 2em;
  background: linear-gradient(90deg, transparent, #59dbee88);
}
.demo-gw::before { right: 100%; }
.demo-gw::after { left: 100%; transform: scaleX(-1); }
.demo-providers { flex: 1.2; display: flex; flex-direction: column; gap: 0.9em; }
.demo-provider { display: flex; flex-direction: column; gap: 0.4em; }
.demo-provider-top { display: flex; justify-content: space-between; color: #a1a1aa; font-size: 0.9em; }
.demo-provider-top b { color: #e4e4e7; font-weight: 600; }
.demo-provider.active .demo-provider-top b { color: #59dbee; }
.demo-bar { height: 0.45em; border-radius: 999px; background: #ffffff12; overflow: hidden; }
.demo-bar i {
  display: block; height: 100%; border-radius: 999px; width: 0;
  background: linear-gradient(90deg, #59dbee, #7c6cf6, #fc73bf);
  transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.demo-provider.retry .demo-bar i { background: linear-gradient(90deg, #fbbf24, #fb7185); }
.demo-route-note { margin-top: 1em; color: #71717a; font-size: 0.9em; text-align: center; }
.demo-route-note.retry { color: #fbbf24; }

.demo-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1em; }
.demo-stat {
  border: 1px solid #ffffff12; background: #11141c; border-radius: 0.8em;
  padding: 0.9em 1.1em; display: flex; flex-direction: column; gap: 0.35em;
}
.demo-stat b { color: #fafafa; font-size: 1.35em; font-weight: 700; font-variant-numeric: tabular-nums; }
.demo-stat span { color: #71717a; font-size: 0.85em; }
.demo-chart { display: flex; align-items: flex-end; gap: 0.6em; height: 52%; margin-top: 1.2em; padding: 0 0.4em; }
.demo-chart i {
  flex: 1; border-radius: 0.35em 0.35em 0 0; min-height: 4%;
  background: linear-gradient(to top, #59dbee33, #59dbee);
  transition: height 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.demo-chart i:nth-child(3n) { background: linear-gradient(to top, #fc73bf33, #fc73bf); }
.demo-chart i:nth-child(4n) { background: linear-gradient(to top, #7c6cf633, #7c6cf6); }

.demo-logs { display: flex; flex-direction: column; gap: 0.5em; height: 100%; overflow: hidden; }
.demo-log {
  display: grid; grid-template-columns: 5.5em 1.4fr 5em 5em 5.5em 1.2em;
  gap: 0.8em; align-items: center;
  border: 1px solid #ffffff0d; background: #11141c; border-radius: 0.6em;
  padding: 0.55em 0.9em; font-family: ui-monospace, monospace; font-size: 0.85em;
  color: #a1a1aa; animation: log-in 0.4s ease;
}
@keyframes log-in { from { opacity: 0; transform: translateY(-6px); } }
.demo-log b { color: #e4e4e7; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.demo-log .ok { width: 0.55em; height: 0.55em; border-radius: 50%; background: #34d399; justify-self: center; }
.demo-log .err { width: 0.55em; height: 0.55em; border-radius: 50%; background: #fb7185; justify-self: center; }
.demo-log .cost { color: #59dbee; }

/* ---------- calendar ---------- */
.rdp-root { background: var(--background); font-size: 0.875rem; }
.rdp-nav { display: flex; align-items: center; justify-content: space-between; }
.rdp-caption { display: flex; align-items: center; justify-content: center; height: 1.75rem; font-weight: 500; font-size: 0.875rem; }
.rdp-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.75rem; height: 1.75rem; border-radius: 0.375rem;
  border: 1px solid var(--border); background: transparent; color: var(--foreground);
  opacity: 0.8; cursor: pointer; transition: opacity 0.2s, background 0.2s;
}
.rdp-btn:hover { opacity: 1; background: var(--accent); }
.rdp-table { margin: 1rem auto 0; border-collapse: collapse; }
.rdp-table th { width: 2rem; font-weight: 400; color: var(--muted-foreground); font-size: 0.8rem; padding-bottom: 0.5rem; }
.rdp-table td { width: 2rem; height: 2rem; text-align: center; padding: 0; }
.rdp-day {
  width: 2rem; height: 2rem; border-radius: 0.375rem; border: 0; background: transparent;
  color: var(--foreground); font-size: 0.8rem; cursor: pointer; transition: background 0.15s;
}
.rdp-day:hover { background: var(--accent); }
.rdp-day.today { background: var(--accent); color: var(--accent-foreground); font-weight: 600; }
.rdp-day.outside { color: var(--muted-foreground); opacity: 0.5; }

/* ---------- beams ---------- */
#beam-paths path.base { stroke: gray; stroke-opacity: 0.2; stroke-width: 2; stroke-linecap: round; fill: none; }
#beam-paths path.beam {
  stroke: url(#beam-grad); stroke-width: 2; stroke-linecap: round; fill: none;
  stroke-dasharray: 26 74; animation: beam-flow 2.8s linear infinite;
}
@keyframes beam-flow { from { stroke-dashoffset: 100; } to { stroke-dashoffset: -100; } }

/* ---------- spotlight cards ---------- */
.spot {
  background: radial-gradient(420px circle at var(--spot-x, 0px) var(--spot-y, 0px),
    color-mix(in oklab, var(--brand) 14%, transparent), transparent 60%);
}
.spot-card:hover .spot { opacity: 1; }

/* ---------- footer big text ---------- */
#footer-big text:first-of-type { transition: stroke-dashoffset 2.4s ease; }
#footer-big.drawn text:first-of-type { stroke-dashoffset: 0; }

/* ---------- to top ---------- */
#to-top.show { opacity: 1; pointer-events: auto; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .public-reveal, .hero-stagger { transition-duration: 0.01s; }
  .animate-scroll { animation-duration: 120s; }
}