:root {
  --bg: #000;
  --bg-elev: #0a0a0a;
  --bg-card: #0d0d0d;
  --fg: #f5f5f5;
  --fg-muted: #a3a3a3;
  --fg-dim: #737373;
  --border: #ffffff14;
  --border-strong: #ffffff24;
  --accent: oklch(.68 .17 264);
  --accent-strong: oklch(57.1% .21 264);
  --ok: oklch(72% .16 150);
  --warn: oklch(76% .15 75);
  --sans: -apple-system, BlinkMacSystemFont, "Inter Variable", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --radius: 12px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
a { color: inherit; text-decoration: none; }
p { margin: 0; }
code, kbd { font-family: var(--mono); font-size: .86em; }
code { color: var(--fg); background: #ffffff0d; border: 1px solid var(--border); padding: 1px 5px; border-radius: 5px; }
pre { margin: 0; font-family: var(--mono); }

.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 32px; }
.display { letter-spacing: -.03em; font-weight: 600; line-height: 1.05; margin: 0; }
.eyebrow {
  font: 500 11px var(--mono); letter-spacing: .14em; text-transform: uppercase;
  color: var(--fg-dim); margin-bottom: 16px;
}
.dim { color: var(--fg-dim); }
.ok { color: var(--ok); }
.accent { color: var(--accent); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 8px; font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: transform .18s, background .18s, border-color .18s, color .18s;
}
.btn svg { flex: none; }
.btn-primary { color: #fff; background: var(--accent-strong); font-weight: 600; }
.btn-primary:hover { background: oklch(62% .2 264); transform: translateY(-1px); }
.btn-ghost { color: var(--fg-muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--fg); border-color: var(--border-strong); background: #ffffff05; }
.btn-lg { padding: 14px 22px; font-size: 15px; border-radius: 10px; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; }
.row.center { justify-content: center; }

/* nav */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1240px; margin: 0 auto; padding: 12px 32px;
  display: flex; justify-content: space-between; align-items: center; gap: 24px;
}
.nav-brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; letter-spacing: -.02em; }
.nav-brand-mark { width: 20px; height: 20px; color: var(--fg); vertical-align: -5px; }
.nav-author {
  margin-right: auto; padding-left: 14px; border-left: 1px solid var(--border-strong);
  color: var(--fg-dim); font-size: 13px; transition: color .18s;
}
.nav-author:hover { color: var(--fg); }
.nav-author .arrow { display: inline-block; opacity: .6; transition: transform .18s, opacity .18s; }
.nav-author:hover .arrow { opacity: 1; transform: translate(2px, -2px); }
.nav-right { display: inline-flex; align-items: center; gap: 4px; }
.nav-link { color: var(--fg-muted); font-size: 13px; padding: 0 10px; transition: color .18s; }
.nav-link:hover { color: var(--fg); }

/* hero */
.hero { position: relative; padding: 72px 0 96px; overflow: hidden; }
.hero-grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(90deg, #ffffff07 1px, transparent 1px), linear-gradient(#ffffff07 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(80% 60% at 50% 40%, #000 40%, transparent 100%);
  mask-image: radial-gradient(80% 60% at 50% 40%, #000 40%, transparent 100%);
}
.hero-inner { position: relative; z-index: 2; text-align: center; }
.hero-title { max-width: 16ch; margin: 24px auto 22px; font-size: clamp(38px, 5.6vw, 76px); text-wrap: balance; }
.hero-sub {
  max-width: 680px; margin: 0 auto 36px; color: var(--fg-muted);
  font-size: clamp(16px, 1.4vw, 19px); text-wrap: balance;
}
.hero-actions { display: flex; flex-direction: column; align-items: center; gap: 16px; margin-bottom: 64px; }
.hero-source-link { display: inline-flex; align-items: center; gap: 8px; color: var(--fg-muted); font-size: 14px; font-weight: 500; transition: color .18s; }
.hero-source-link:hover { color: var(--fg); }
.hero-source-link .arrow { opacity: .6; transition: transform .18s, opacity .18s; }
.hero-source-link:hover .arrow { opacity: 1; transform: translate(2px, -2px); }
.hero-preview { position: relative; z-index: 2; max-width: 1180px; margin: 0 auto; box-shadow: 0 40px 120px -40px oklch(57% .21 264 / .45); }

/* window / terminal chrome */
.window { background: var(--bg-elev); border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.window-head { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.window-head > span { width: 10px; height: 10px; border-radius: 999px; background: #262626; }
.window-title { flex: 1; margin-right: 46px; text-align: center; font: 11px var(--mono); color: var(--fg-dim); }
.split { display: grid; grid-template-columns: 1fr 1fr; }
.pane { padding: 18px 20px 22px; min-width: 0; overflow-x: auto; }
.pane + .pane { border-left: 1px solid var(--border); }
.pane-label { font: 500 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--fg-dim); margin-bottom: 12px; }
.pane pre { font-size: 12.5px; line-height: 1.75; color: var(--fg); }
.t-sys { color: var(--warn); }
.t-pol { color: oklch(75% .13 320); }
.t-flow { color: var(--accent); }
.t-bt { color: oklch(75% .12 220); }
.t-net { color: oklch(78% .1 180); }
.t-state { color: var(--ok); }
.cursor { color: var(--accent); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* sections */
.sec { padding: 112px 0; border-top: 1px solid var(--border); }
.sec-title { font-size: clamp(30px, 3.6vw, 48px); max-width: 18ch; margin-bottom: 18px; text-wrap: balance; }
.sec-sub { color: var(--fg-muted); max-width: 620px; font-size: 17px; }

.policy-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); margin-top: 48px;
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.policy-cell { padding: 22px 20px 24px; background: var(--bg-elev); transition: background .18s; }
.policy-cell + .policy-cell { border-left: 1px solid var(--border); }
.policy-cell:hover { background: #ffffff08; }
.policy-cell kbd {
  display: inline-block; color: var(--fg); font-size: 12.5px; margin-bottom: 12px;
  padding: 3px 8px; border: 1px solid var(--border-strong); border-radius: 6px; background: #ffffff08;
}
.policy-cell p { color: var(--fg-muted); font-size: 14px; line-height: 1.45; }
.captions { display: flex; flex-wrap: wrap; gap: 8px 32px; list-style: none; padding: 0; margin: 24px 0 0; color: var(--fg-dim); font-size: 14px; }
.captions li::before { content: "✓ "; color: var(--ok); }

.two-col { display: grid; grid-template-columns: 1.05fr 1fr; gap: 64px; align-items: center; }
.checks { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 14px; }
.checks li { position: relative; padding-left: 26px; color: var(--fg-muted); font-size: 15px; }
.checks li::before { content: "→"; position: absolute; left: 0; color: var(--accent); }
.checks b { color: var(--fg); font-weight: 600; }
pre.seq { padding: 22px; font-size: 12.5px; line-height: 1.6; color: var(--fg-muted); overflow-x: auto; }

.card-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 48px; }
.card {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; transition: border-color .18s;
}
.card:hover { border-color: var(--border-strong); }
.card h3 { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; letter-spacing: -.01em; margin: 0 0 10px; }
.card h3 svg, .card .glyph { width: 18px; height: 18px; flex: none; color: var(--accent); font: 600 16px var(--mono); text-align: center; }
.card p { color: var(--fg-muted); font-size: 14px; line-height: 1.55; }
.card pre {
  margin-top: 12px; padding: 10px 12px; font-size: 11.5px; color: var(--fg);
  background: #000; border: 1px solid var(--border); border-radius: 8px; overflow-x: auto;
}
.install .num { display: block; font: 500 12px var(--mono); color: var(--accent); margin-bottom: 14px; }
.fine { margin-top: 32px; max-width: 860px; color: var(--fg-dim); font-size: 13px; }

.open-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 56px; align-items: center; }
.term { padding: 20px 22px; font: 13px/1.8 var(--mono); }
.term > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term .prompt { color: var(--accent); margin-right: 10px; }
.steps { margin: 24px 0 32px; padding-left: 20px; color: var(--fg-muted); display: grid; gap: 8px; font-size: 15px; }
.steps li::marker { color: var(--fg-dim); font-family: var(--mono); font-size: 13px; }

.sec-cta { position: relative; padding: 128px 0; text-align: center; border-top: 1px solid var(--border); overflow: hidden; }
.cta-inner { position: relative; }
.cta-title { font-size: clamp(40px, 6vw, 72px); max-width: 14ch; margin: 0 auto; text-wrap: balance; }
.cta-sub { max-width: 560px; margin: 20px auto 36px; color: var(--fg-muted); font-size: 18px; }

.footer { border-top: 1px solid var(--border); padding: 28px 0 40px; color: var(--fg-dim); font-size: 13px; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.footer .nav-brand-mark { width: 16px; height: 16px; vertical-align: -3px; margin-right: 6px; }
.footer-links { display: flex; gap: 20px; }
.footer-links a:hover { color: var(--fg); }
.footer-author { color: var(--fg-muted); text-decoration: underline; text-decoration-color: #a3a3a366; text-underline-offset: 3px; }
.footer-meta {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px;
  margin-top: 20px; font: 12px var(--mono); color: var(--fg-dim);
}
.footer-author:hover { color: var(--fg); text-decoration-color: var(--fg); }

/* failover demo — CSS-only tabs (radio + label) and a looping timeline */
.fo-radio { position: absolute; opacity: 0; pointer-events: none; }
.failover .sc-crash, #fo-crash:checked ~ .container .sc-off { display: none; }
#fo-crash:checked ~ .container .sc-crash { display: block; }
#fo-crash:checked ~ .container .window-title .sc-crash { display: inline; }
.seg {
  display: inline-flex; gap: 4px; margin-top: 28px; padding: 4px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg-elev);
}
.seg label {
  padding: 7px 14px; border-radius: 7px; font-size: 13px; font-weight: 500;
  color: var(--fg-muted); cursor: pointer; transition: background .18s, color .18s;
}
.seg label:hover { color: var(--fg); }
#fo-off:checked ~ .container label[for="fo-off"],
#fo-crash:checked ~ .container label[for="fo-crash"] { background: #ffffff12; color: var(--fg); box-shadow: inset 0 0 0 1px var(--border-strong); }
#fo-off:focus-visible ~ .container label[for="fo-off"],
#fo-crash:focus-visible ~ .container label[for="fo-crash"] { outline: 2px solid var(--accent); outline-offset: 2px; }
.failover .checks { margin-top: 24px; }

.fo-panel .w { animation-duration: 9s; animation-iteration-count: infinite; animation-timing-function: linear; animation-fill-mode: both; }
.fo-panel.sc-crash .w { animation-duration: 13s; }

.fo-stage {
  display: grid; grid-template-columns: 132px 1fr 132px; align-items: center;
  padding: 28px 24px 24px; border-bottom: 1px solid var(--border);
}
.fo-mac {
  display: grid; justify-items: center; gap: 6px; padding: 16px 8px 14px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
}
.fo-mac svg { width: 34px; height: 34px; color: var(--fg); }
.fo-mac b { font-size: 13px; font-weight: 600; }
.fo-state { display: grid; font: 11px var(--mono); color: var(--fg-muted); }
.fo-state > i { grid-area: 1 / 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-style: normal; white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #404040; flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.warn { background: var(--warn); }
.dot.err { background: oklch(65% .2 25); }
.dot.pulse { animation: blink 1s steps(1) infinite; }

.fo-track { position: relative; height: 56px; margin: 0 -1px; }
.fo-track::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%;
  border-top: 1px dashed var(--border-strong);
}
.fo-token {
  position: absolute; top: 50%; left: 34px; width: 44px; height: 44px; margin: -22px 0 0 -22px;
  display: grid; place-items: center; border-radius: 12px;
  background: var(--bg-elev); border: 1px solid var(--border-strong); color: var(--accent);
  box-shadow: 0 10px 30px -10px oklch(57% .21 264 / .6);
  animation: 9s linear infinite both;
}
.fo-token svg { width: 24px; height: 24px; }
.sc-off .fo-token { animation-name: tok-off; }
.sc-crash .fo-token { animation-name: tok-crash; animation-duration: 13s; }
.sc-off .fo-a { animation: dim-off 9s linear infinite both; }
.sc-crash .fo-a { animation: dim-crash 13s linear infinite both; }

@keyframes tok-off {
  0%, 24% { left: 34px; }
  42%, 95% { left: calc(100% - 34px); opacity: 1; }
  99% { left: calc(100% - 34px); opacity: 0; }
  100% { left: 34px; opacity: 0; }
}
@keyframes tok-crash {
  0%, 9% { left: 34px; border-color: var(--border-strong); }
  10%, 44% { left: 34px; opacity: 1; color: oklch(65% .2 25); border-color: oklch(65% .2 25 / .6); }
  46%, 52% { left: 34px; opacity: .12; }
  54% { left: 34px; opacity: 1; color: var(--accent); border-color: var(--border-strong); }
  66%, 95% { left: calc(100% - 34px); opacity: 1; }
  99% { left: calc(100% - 34px); opacity: 0; }
  100% { left: 34px; opacity: 0; }
}
@keyframes dim-off { 0%, 49% { opacity: 1; } 51%, 95% { opacity: .35; } 100% { opacity: 1; } }
@keyframes dim-crash { 0%, 9% { opacity: 1; } 10%, 95% { opacity: .3; } 100% { opacity: 1; } }

.fo-log { padding: 16px 20px 20px; min-height: 236px; font: 12px/1.9 var(--mono); color: var(--fg); overflow-x: auto; }
.fo-log > div { white-space: pre; }
.host {
  display: inline-block; width: 18px; margin-right: 10px; text-align: center;
  border-radius: 4px; font-size: 10.5px; color: var(--fg-dim);
}
.host-a { background: #ffffff0d; }
.host-b { background: oklch(57% .21 264 / .25); color: var(--fg); }
.you { color: var(--warn); }
.err { color: oklch(70% .18 25); }
@keyframes w0-10 { 0%, 9.5% { opacity: 1; } 10%, 100% { opacity: 0; } }
@keyframes w0-12 { 0%, 11.5% { opacity: 1; } 12%, 100% { opacity: 0; } }
@keyframes w0-18 { 0%, 17.5% { opacity: 1; } 18%, 100% { opacity: 0; } }
@keyframes w0-42 { 0%, 41.5% { opacity: 1; } 42%, 100% { opacity: 0; } }
@keyframes w10-100 { 0%, 10% { opacity: 0; transform: translateY(3px); } 11.5%, 95% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes w12-50 { 0%, 12% { opacity: 0; } 13%, 49.5% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes w12-100 { 0%, 12% { opacity: 0; transform: translateY(3px); } 13.5%, 95% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes w18-66 { 0%, 18% { opacity: 0; } 19%, 65.5% { opacity: 1; } 66%, 100% { opacity: 0; } }
@keyframes w18-100 { 0%, 18% { opacity: 0; transform: translateY(3px); } 19.5%, 95% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes w24-100 { 0%, 24% { opacity: 0; transform: translateY(3px); } 25.5%, 95% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes w30-100 { 0%, 30% { opacity: 0; transform: translateY(3px); } 31.5%, 95% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes w42-100 { 0%, 42% { opacity: 0; transform: translateY(3px); } 43.5%, 95% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes w44-100 { 0%, 44% { opacity: 0; transform: translateY(3px); } 45.5%, 95% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes w48-100 { 0%, 48% { opacity: 0; transform: translateY(3px); } 49.5%, 95% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes w50-100 { 0%, 50% { opacity: 0; transform: translateY(3px); } 51.5%, 95% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes w60-100 { 0%, 60% { opacity: 0; transform: translateY(3px); } 61.5%, 95% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes w66-100 { 0%, 66% { opacity: 0; transform: translateY(3px); } 67.5%, 95% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes w70-100 { 0%, 70% { opacity: 0; transform: translateY(3px); } 71.5%, 95% { opacity: 1; transform: none; } 100% { opacity: 0; } }

@media (width <= 1100px) {
  .policy-grid { grid-template-columns: repeat(3, 1fr); }
  .policy-cell:nth-child(4) { border-left: 0; }
  .policy-cell:nth-child(n+4) { border-top: 1px solid var(--border); }
  .card-grid { grid-template-columns: 1fr 1fr; }
}
@media (width <= 860px) {
  .container, .nav-inner { padding-left: 20px; padding-right: 20px; }
  .nav-link { display: none; }
  .split, .two-col, .open-grid { grid-template-columns: 1fr; }
  .pane + .pane { border-left: 0; border-top: 1px solid var(--border); }
  .two-col, .open-grid { gap: 40px; }
  .fo-stage { grid-template-columns: 104px 1fr 104px; padding: 22px 16px 18px; }
  .sec { padding: 80px 0; }
}
@media (width <= 560px) {
  .policy-grid, .card-grid { grid-template-columns: 1fr; }
  .policy-cell + .policy-cell { border-left: 0; border-top: 1px solid var(--border); }
  .nav-brand span { font-size: 14px; }
  .nav-author { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; }
  .fo-panel .w, .fo-token, .fo-a { animation: none !important; }
  .fo-panel .w { opacity: 0; }
  .fo-panel .w.end { opacity: 1; }
  .fo-token { left: calc(100% - 34px); }
  .fo-a { opacity: .35; }
}
