:root {
  color-scheme: dark;
  --bg: #151720;
  --bg-soft: #1e232b;
  --panel: #1e232b;
  --card: #1e232b;
  --text: #fefefe;
  --muted: #d4d4ce;
  --accent: #e0d0fc;
  --accent-strong: #e0d0fc;
  --border: #ffffff1a;
  --border-strong: #fefefe42;
  --code-bg: #1e232b;
  --nav-bg: rgba(21, 23, 32, 0.84);
  --mark-ink: #000000;
  --glow: rgba(224, 208, 252, 0.16);
  --tok-key: #8be9fd;
  --tok-section: #ff79c6;
  --tok-string: #f1fa8c;
  --tok-number: #bd93f9;
  --tok-comment: #6272a4;
  --tok-punct: #d4d4ce;
  --max: 1180px;
  --sans: ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
strong { color: var(--text); }
code { font-family: var(--mono); font-size: 0.92em; }

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

section[id] { scroll-margin-top: 84px; }

/* Navigation */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}
.nav-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font: 600 14px/1 var(--mono);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--mark-ink);
  display: grid;
  place-items: center;
  font: 700 13px/1 var(--mono);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 14px;
  color: var(--muted);
}
.nav-links a { color: inherited; white-space: nowrap; }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links button {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.nav-links button:hover { color: var(--text); }
.nav-rune { color: var(--accent) !important; }

/* Hero */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  align-items: center;
  gap: clamp(28px, 5vw, 64px);
  padding-top: 76px;
  padding-bottom: 48px;
}
.hero::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -160px;
  height: 560px;
  background: radial-gradient(55% 55% at 50% 0%, var(--glow), transparent 72%);
  pointer-events: none;
}
.hero-copy {
  position: relative;
  min-width: 0;
}
.hero-demo {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.eyebrow {
  position: relative;
  margin: 0;
  font: 600 11px/1.4 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.hero h1 {
  position: relative;
  margin: 18px 0 22px;
  font-size: clamp(44px, 6.2vw, 82px);
  line-height: 0.92;
  letter-spacing: -0.05em;
  font-weight: 700;
}
.hero h1 .accent { color: var(--accent); }
.lede {
  position: relative;
  max-width: 620px;
  margin: 0;
  font-size: clamp(16px, 1.6vw, 19px);
  line-height: 1.6;
  color: var(--muted);
}
.actions {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}
.hero-note {
  position: relative;
  margin: 22px 0 0;
  color: var(--muted);
  font: 12px/1.5 var(--mono);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  padding: 0 18px;
  border-radius: 9px;
  border: 1px solid transparent;
  font: 600 14px/1 var(--sans);
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease, border-color 120ms ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--mark-ink); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { border-color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }

/* Demo */
.demo-meta,
.demo-status {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  font: 11.5px/1.4 var(--mono);
  color: var(--muted);
}
.demo-meta .mono { color: var(--text); }
.demo-status { font-size: 12px; color: var(--text); }
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  transition: background 120ms ease, box-shadow 120ms ease;
}
.demo-status[data-active="true"] .status-dot { background: var(--accent); box-shadow: 0 0 10px var(--glow); }
.demo-status[data-active="true"] .demo-trigger { display: none; }
.demo-canvas {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
}
.demo-canvas:has(.demo-loading) { min-height: 330px; }
.demo-canvas canvas {
  display: block;
  width: 100%;
  transition: opacity 200ms ease, filter 200ms ease;
}
.hero-demo[data-active="false"] .demo-canvas canvas {
  opacity: 0.5;
  filter: saturate(0.7);
  pointer-events: none;
}
.hero-demo[data-active="true"] .demo-canvas canvas {
  opacity: 1;
  filter: none;
  pointer-events: auto;
}
.demo-canvas canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: 14px; }
.demo-cta {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 0s;
}
.demo-cta .btn { pointer-events: auto; }
.hero-demo[data-active="true"] .demo-cta {
  opacity: 0;
  visibility: hidden;
  transition: opacity 180ms ease, visibility 0s 180ms;
}
.demo-canvas:has(.demo-loading) .demo-cta { visibility: hidden; }
.demo-loading {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--muted);
  font: 12.5px var(--mono);
}
.demo-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
}
.demo-controls-secondary { margin-top: 2px; gap: 14px; }
.link-button {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  font: 12px/1 var(--mono);
  cursor: pointer;
}
.link-button:hover { text-decoration: underline; }

/* Theme picker */
.theme-control { position: relative; }
.theme-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font: 12px/1 var(--mono);
  cursor: pointer;
}
.theme-button:hover { color: var(--text); border-color: var(--accent); }
.theme-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--glow);
}
.theme-popover {
  position: absolute;
  left: 50%;
  top: calc(100% + 10px);
  transform: translateX(-50%);
  width: min(580px, calc(100vw - 40px));
  padding: 12px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  z-index: 30;
}
.theme-popover-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 2px 2px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font: 11.5px/1.4 var(--mono);
}
.theme-popover-head strong { color: var(--text); }
.theme-popover-head a { color: var(--accent); }
.theme-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  max-height: min(40vh, 320px);
  overflow: auto;
  padding: 2px;
}
.theme-swatch {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 8px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: var(--sw-bg);
  cursor: pointer;
  text-align: left;
}
.theme-swatch:hover { border-color: var(--sw-accent); }
.theme-swatch[aria-pressed="true"] { border-color: var(--sw-accent); box-shadow: 0 0 0 1px var(--sw-accent); }
.sw-bars { display: flex; gap: 3px; }
.sw-bars i { display: block; flex: 1; height: 11px; border-radius: 3px; background: var(--sw-panel); }
.sw-bars i:nth-child(2) { flex: 0 0 16px; background: var(--sw-accent); }
.sw-bars i:nth-child(3) { flex: 0 0 26px; background: var(--sw-muted); }
.sw-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 11px/1.2 var(--mono);
  color: var(--sw-fg);
}
.theme-note { margin: 10px 2px 2px; color: var(--muted); font-size: 11.5px; }

/* Theme reveal: the split wipe measured from omarchy.org, 200ms, ease-in. */
@property --theme-wipe {
  syntax: "<length-percentage>";
  inherits: false;
  initial-value: 0px;
}
::view-transition-group(root) { animation: none; }
::view-transition-image-pair(root) { animation: none; }
::view-transition-old(root),
::view-transition-new(root) {
  mix-blend-mode: normal;
  opacity: 1;
  animation: none;
}
::view-transition-old(root) {
  z-index: 1;
  -webkit-mask-image: linear-gradient(100deg, #000 0, #000 calc(50% - var(--theme-wipe) + 1px), transparent calc(50% - var(--theme-wipe) + 1px), transparent calc(50% + var(--theme-wipe) - 1px), #000 calc(50% + var(--theme-wipe) - 1px), #000 100%);
  mask-image: linear-gradient(100deg, #000 0, #000 calc(50% - var(--theme-wipe) + 1px), transparent calc(50% - var(--theme-wipe) + 1px), transparent calc(50% + var(--theme-wipe) - 1px), #000 calc(50% + var(--theme-wipe) - 1px), #000 100%);
  mask-size: 100% 100%;
  mask-repeat: no-repeat;
  mask-mode: alpha;
  animation: theme-split-wipe 200ms cubic-bezier(0.7, 0, 1, 1) both;
}
::view-transition-new(root) { z-index: 0; }
@keyframes theme-split-wipe {
  0% { --theme-wipe: 0px; }
  100% { --theme-wipe: 80%; }
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) { animation: none !important; }
}

/* Action toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 12px);
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font: 600 13px/1.2 var(--mono);
  text-align: center;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 40;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Sections */
.section { padding-top: 68px; }
.section h2 {
  margin: 10px 0 18px;
  font-size: clamp(28px, 3.6vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.03em;
}
.prose { max-width: 760px; }
.prose p { margin: 0 0 14px; color: var(--muted); }
.prose p:last-child { margin-bottom: 0; }

/* Why */
.why-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 32px;
  align-items: start;
}
.mapping {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  padding: 18px;
}
.mapping-note,
.mapping-foot {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12.5px;
}
.mapping-foot { margin: 12px 0 0; }
.mapping table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.mapping th,
.mapping td {
  text-align: left;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.mapping th {
  color: var(--muted);
  font: 600 10.5px/1 var(--mono);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.mapping tr:last-child td { border-bottom: 0; }
.mapping td:last-child { color: var(--muted); }

/* Cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin-top: 8px;
}
.card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  padding: 18px;
  transition: transform 120ms ease, border-color 120ms ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.card h3 { margin: 0 0 8px; font-size: 16px; letter-spacing: -0.01em; }
.card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }

/* How */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 8px;
}
.step { border-top: 1px solid var(--border); padding-top: 14px; }
.step-num {
  font: 600 11px/1 var(--mono);
  letter-spacing: 0.12em;
  color: var(--accent);
}
.step h3 { margin: 8px 0 6px; font-size: 16px; }
.step p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }

/* Try */
.keys {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px 24px;
  margin-top: 8px;
}
.key-pair {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  color: var(--muted);
  font-size: 14px;
}
.key-pair em {
  margin-left: 6px;
  font-style: normal;
  color: var(--text);
}
.try-note { margin-top: 20px; color: var(--muted); font-size: 13px; }

kbd {
  display: inline-block;
  font: 600 11px/1 var(--mono);
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 3px 6px;
}

/* Inspired by */
.lineage {
  margin: 18px 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow-x: auto;
}
.lineage strong { color: var(--text); }
.credits { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.credit {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--muted);
}

/* Footer */
.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px;
  margin-top: 56px;
  padding-top: 24px;
  padding-bottom: 48px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}
.footer p { margin: 0; }

/* Config dialog */
.config-dialog {
  width: min(1000px, 92vw);
  max-height: 86vh;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.config-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}
.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.dialog-head h2 { margin: 0; font: 600 15px/1.2 var(--mono); }
.dialog-head p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
.dialog-actions { display: flex; align-items: center; gap: 8px; }
.btn-small { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.icon-btn {
  appearance: none;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); }
.code {
  margin: 0;
  padding: 16px 18px 20px;
  max-height: 68vh;
  overflow: auto;
  background: var(--code-bg);
  font: 12.5px/1.55 var(--mono);
  tab-size: 2;
}
.code code { white-space: pre; }
.tok-comment { color: var(--tok-comment); font-style: italic; }
.tok-section { color: var(--tok-section); font-weight: 600; }
.tok-key { color: var(--tok-key); }
.tok-string { color: var(--tok-string); }
.tok-number,
.tok-literal { color: var(--tok-number); }
.tok-punct { color: var(--tok-punct); }

/* Responsive */
@media (max-width: 980px) {
  .why-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; padding-top: 64px; }
  .hero-demo { max-width: 560px; margin: 0 auto; width: 100%; }
}

@media (max-width: 760px) {
  .nav-hide-sm { display: none; }
  .nav-links { gap: 14px; }
  .nav-inner { padding: 10px 18px; }
  .wrap { padding-left: 18px; padding-right: 18px; }
  .hero h1 { font-size: clamp(40px, 13vw, 64px); }
  .section { padding-top: 50px; }
  .footer { margin-top: 40px; }
  .theme-popover {
    position: fixed;
    left: 50%;
    right: auto;
    top: auto;
    bottom: 18px;
    transform: translateX(-50%);
    width: calc(100vw - 36px);
    max-height: 70vh;
    overflow: auto;
  }
  .theme-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); max-height: 52vh; }
  .config-dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  .code { max-height: calc(100vh - 82px); }
}

@media (max-width: 520px) {
  .nav-hide-xs { display: none; }
}

@media (max-width: 420px) {
  .theme-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
