/* EnvRelay's homepage. Dark only, no web fonts, no third-party requests.
   The class names are shared with main.js, which builds the terminal demo. */

:root {
  color-scheme: dark;
  --bg: #07080c;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --fg: #e9ecf5;
  --muted: #9ba3b8;
  --dim: #7c849b;
  --cyan: #5eead4;
  --blue: #7aa2ff;
  --violet: #a78bfa;
  --pink: #f472b6;
  --amber: #fbbf24;
  --green: #4ade80;
  --red: #f87171;
  --grad: linear-gradient(100deg, var(--cyan), var(--blue) 38%, var(--violet) 68%, var(--pink));
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --radius: 18px;
  --gutter: clamp(1rem, 4vw, 2rem);
  /* Chinese, Japanese and Korean pick their own fonts below, so that each
     script gets its own glyph forms. */
  --cjk: sans-serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, var(--cjk), sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", var(--cjk), monospace;
}
:root:lang(zh-Hans) { --cjk: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", "Source Han Sans SC"; }
:root:lang(zh-Hant) { --cjk: "PingFang TC", "Microsoft JhengHei", "Noto Sans CJK TC", "Noto Sans TC", "Source Han Sans TC"; }
:root:lang(ja) { --cjk: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", YuGothic, Meiryo, "Noto Sans CJK JP", "Noto Sans JP"; }
:root:lang(ko) { --cjk: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans CJK KR", "Noto Sans KR"; }

/* ---- Base ---------------------------------------------------------------- */

*,
*::before,
*::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
  background: var(--bg);
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; }
img,
svg { display: block; }
/* Read out, not shown: the language switcher's label. */
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
code {
  padding: 0.12em 0.4em;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  color: #d5e2ff;
  font-family: var(--mono);
  font-size: 0.86em;
  overflow-wrap: anywhere;
}
h1,
h2,
h3 { overflow-wrap: break-word; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
::selection { background: rgba(122, 162, 255, 0.35); color: #fff; }

.wrap { width: min(100% - 2 * var(--gutter), 72rem); margin-inline: auto; }
main,
.foot { position: relative; z-index: 1; }

/* ---- Arrival --------------------------------------------------------------
   With scripts on, the hero rises in once as the page opens; without them
   the page is simply there. */

.js .hero > * { animation: rise 0.9s var(--ease) both; animation-delay: calc(var(--i) * 90ms + 60ms); }
.hero > :nth-child(1) { --i: 0; }
.hero > :nth-child(2) { --i: 1; }
.hero > :nth-child(3) { --i: 2; }
.hero > :nth-child(4) { --i: 3; }
.hero > :nth-child(5) { --i: 4; }
.hero > :nth-child(6) { --i: 5; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); filter: blur(6px); } }

.reveals .reveal {
  transition:
    opacity 0.8s var(--ease) var(--d, 0ms),
    transform 0.8s var(--ease) var(--d, 0ms);
}
.reveals .reveal:not(.in) { opacity: 0; transform: translateY(22px); }

/* ---- Background ---------------------------------------------------------- */

.glow {
  position: absolute;
  inset: 0 0 auto;
  z-index: 0;
  height: min(1400px, 150vh);
  overflow: hidden;
  pointer-events: none;
}
.glow::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 40%;
  background: linear-gradient(transparent, var(--bg));
}
.orb { position: absolute; aspect-ratio: 1; border-radius: 50%; }
.o1 {
  top: -20rem;
  left: -14rem;
  width: 46rem;
  background: radial-gradient(closest-side, rgba(94, 234, 212, 0.26), transparent);
  animation: drift-a 24s ease-in-out infinite alternate;
}
.o2 {
  top: -12rem;
  right: -14rem;
  width: 42rem;
  background: radial-gradient(closest-side, rgba(167, 139, 250, 0.3), transparent);
  animation: drift-b 28s ease-in-out infinite alternate;
}
.o3 {
  top: 16rem;
  left: 34%;
  width: 36rem;
  background: radial-gradient(closest-side, rgba(122, 162, 255, 0.2), transparent);
  animation: drift-c 32s ease-in-out infinite alternate;
}
@keyframes drift-a { to { transform: translate(9rem, 6rem) scale(1.12); } }
@keyframes drift-b { to { transform: translate(-7rem, 8rem) scale(0.94); } }
@keyframes drift-c { to { transform: translate(-10rem, -3rem) scale(1.16); } }
.grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-position: center top;
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 75% 60% at 50% 0%, #000 25%, transparent 78%);
  mask-image: radial-gradient(ellipse 75% 60% at 50% 0%, #000 25%, transparent 78%);
}

/* ---- Navigation ---------------------------------------------------------- */

.nav { position: sticky; top: 0; z-index: 20; transition: background-color 0.3s ease, box-shadow 0.3s ease; }
.nav.scrolled {
  background: rgba(7, 8, 12, 0.74);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  backdrop-filter: saturate(160%) blur(16px);
  box-shadow: 0 1px 0 var(--line);
}
.nav-in { display: flex; align-items: center; gap: 1.6rem; height: 4rem; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-right: auto;
  font-size: 1.06rem;
  font-weight: 750;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.logo { width: 28px; height: 28px; }
.links { display: flex; gap: 1.6rem; font-size: 0.92rem; }
.links a { color: var(--muted); text-decoration: none; transition: color 0.2s; }
.links a:hover { color: var(--fg); }
.lang { position: relative; display: flex; align-items: center; }
/* Going to another language's page takes index.html's head script. */
html:not(.js) .lang { display: none; }
.lang svg {
  position: absolute;
  left: 0.75rem;
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.6;
  pointer-events: none;
}
.lang select {
  -webkit-appearance: none;
  appearance: none;
  max-width: 13rem;
  padding: 0.42rem 2rem 0.42rem 2.15rem;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.04);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%239ba3b8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 0.8rem center;
  background-repeat: no-repeat;
  background-size: 0.65rem auto;
  color: var(--fg);
  font: inherit;
  font-size: 0.88rem;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}
.lang select:hover { border-color: rgba(122, 162, 255, 0.5); background-color: rgba(122, 162, 255, 0.08); }
.lang option { background: #0c0e15; color: var(--fg); }

/* ---- Hero ---------------------------------------------------------------- */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(3.5rem, 10vw, 7.5rem) 0 clamp(3rem, 7vw, 5rem);
  text-align: center;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  max-width: 100%;
  padding: 0.38rem 1rem;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 0.86rem;
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}
.badge:hover { border-color: rgba(122, 162, 255, 0.5); color: var(--fg); }
.badge-v {
  margin-left: -0.55rem;
  padding: 0.08rem 0.55rem;
  border-radius: 999px;
  background: var(--grad);
  color: var(--bg);
  font: 700 0.74rem/1.5 var(--mono);
}
h1 {
  margin: 1.5rem 0 1.3rem;
  font-size: clamp(2rem, 0.95rem + 5.1vw, 5.1rem);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
h1 > span { display: block; }
.grad {
  width: fit-content;
  margin-inline: auto;
  background: linear-gradient(100deg, var(--cyan), var(--blue), var(--violet), var(--pink), var(--violet), var(--blue), var(--cyan));
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 9s ease-in-out infinite alternate;
}
@keyframes shimmer { to { background-position: 100% 0; } }
.lead {
  max-width: 44rem;
  margin: 0 0 2.4rem;
  color: var(--muted);
  font-size: clamp(1.04rem, 0.9rem + 0.6vw, 1.24rem);
  text-wrap: pretty;
}

/* The install command, here and at the end of the page. A copy button that
   does not fit beside the command takes a line of its own, on the right. */
.cmd {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
  max-width: 100%;
  padding: 0.55rem 0.55rem 0.55rem 1.25rem;
  border-radius: 16px;
  background: rgba(12, 14, 21, 0.9);
  box-shadow: 0 24px 70px -28px rgba(122, 162, 255, 0.6);
  font: 500 clamp(0.86rem, 0.8rem + 0.3vw, 1.02rem)/1.5 var(--mono);
  text-align: left;
}
.cmd::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  background: linear-gradient(100deg, rgba(94, 234, 212, 0.75), rgba(122, 162, 255, 0.45), rgba(167, 139, 250, 0.75));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}
.cmd .ps { color: var(--cyan); user-select: none; }
.cmd code { padding: 0; background: none; color: var(--fg); font: inherit; white-space: nowrap; overflow-wrap: normal; }
.copy {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin-left: auto;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--line-2);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg);
  font: 600 0.84rem/1 var(--sans);
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}
.copy:hover { background: rgba(255, 255, 255, 0.1); }
.copy svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.copy[data-state="ui.copied"] { border-color: rgba(74, 222, 128, 0.5); color: var(--green); }
.copy[data-state="ui.copyFailed"] { border-color: rgba(248, 113, 113, 0.5); color: var(--red); }

.hero .note { margin: 1rem 0 0; color: var(--dim); font-size: 0.88rem; text-wrap: balance; }
.hero .note a { color: var(--muted); text-decoration-color: rgba(155, 163, 184, 0.45); text-underline-offset: 3px; }
.hero .note a:hover { color: var(--fg); }

.asks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  width: min(100%, 46rem);
  margin-top: 3rem;
}
.asks-label {
  grid-column: 1 / -1;
  margin: 0 0 0.1rem;
  color: var(--dim);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.ask {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.95rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
  text-align: left;
}
.ask-where { color: var(--dim); font-size: 0.76rem; }
.ask q { color: var(--fg); font: 0.95rem/1.5 var(--mono); quotes: none; }
.ask q::before { content: "› "; color: var(--violet); }

/* ---- Sections ------------------------------------------------------------ */

.demo,
.carry,
.arch,
.security,
.works { padding-block: clamp(3.5rem, 8vw, 6.5rem); }
section > .head { max-width: 46rem; margin: 0 auto clamp(2.2rem, 5vw, 3.5rem); text-align: center; }
h2 {
  margin: 0 0 0.9rem;
  font-size: clamp(1.75rem, 1.1rem + 2.6vw, 3rem);
  font-weight: 780;
  line-height: 1.12;
  letter-spacing: -0.028em;
  text-wrap: balance;
}
section > .head p { margin: 0; color: var(--muted); font-size: 1.08rem; text-wrap: pretty; }

/* ---- The demo ------------------------------------------------------------ */

.demo-grid { display: grid; gap: 1.25rem; }
.demo-grid.has-term { grid-template-columns: minmax(0, 1fr) 19.5rem; align-items: start; }

.term {
  position: relative;
  isolation: isolate;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(22, 25, 37, 0.95), rgba(9, 11, 17, 0.97));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.07),
    0 40px 100px -40px rgba(0, 0, 0, 0.9),
    0 0 140px -50px rgba(122, 162, 255, 0.55);
}
/* A light that runs around the terminal's edge. */
@property --angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.term::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  padding: 1px;
  border-radius: inherit;
  background: conic-gradient(
    from var(--angle),
    transparent 0 62%,
    rgba(94, 234, 212, 0.9) 74%,
    rgba(122, 162, 255, 0.9) 82%,
    rgba(167, 139, 250, 0.9) 90%,
    rgba(244, 114, 182, 0.75) 96%,
    transparent
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  animation: orbit 7s linear infinite;
  pointer-events: none;
}
@keyframes orbit { to { --angle: 360deg; } }
.term.is-paused::before { animation-play-state: paused; }

.term-bar { display: flex; align-items: center; gap: 0.75rem; height: 2.9rem; padding: 0 0.55rem 0 1rem; border-bottom: 1px solid var(--line); }
.dots { display: flex; flex: none; gap: 0.45rem; }
.dots i { width: 0.72rem; height: 0.72rem; border-radius: 50%; background: #ff5f57; }
.dots i:nth-child(2) { background: #febc2e; }
.dots i:nth-child(3) { background: #28c840; }
.tabs { display: flex; flex: 1 1 auto; gap: 0.3rem; min-width: 0; }
.tab {
  flex: 0 1 auto;
  min-width: 2.5rem;
  max-width: 10rem;
  overflow: hidden;
  padding: 0.26rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--dim);
  font: 0.78rem/1.4 var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.2s, background-color 0.2s, border-color 0.2s;
}
.tab.on { border-color: var(--line); background: rgba(255, 255, 255, 0.06); color: var(--fg); }
.machine { flex: none; padding: 0.22rem 0.65rem; border-radius: 999px; font: 650 0.72rem/1.4 var(--sans); white-space: nowrap; }
.machine:empty { display: none; }
.machine[data-m="old"] { background: rgba(167, 139, 250, 0.13); box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.38); color: #c4b5fd; }
.machine[data-m="new"] { background: rgba(94, 234, 212, 0.1); box-shadow: inset 0 0 0 1px rgba(94, 234, 212, 0.38); color: var(--cyan); }
.term-ctl { display: flex; flex: none; gap: 0.15rem; }
.term.still .term-ctl { display: none; }
.icon-btn {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.08); color: var(--fg); }
.icon-btn svg { width: 1.05rem; height: 1.05rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.i-play { display: none; fill: currentColor; }
.is-paused .i-pause { display: none; }
.is-paused .i-play { display: inline; }

.term-screen { position: relative; height: 31rem; color: #d3d8e8; font: 13.5px/1.62 var(--mono); }
.term-body { position: absolute; inset: 0; transition: opacity 0.45s ease, filter 0.45s ease; }
.term.swap .term-body { opacity: 0; filter: blur(3px); }
.pane { position: absolute; inset: 0; display: none; flex-direction: column; }
.pane.on { display: flex; }
.log {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem 1.15rem 1.1rem;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
  scrollbar-width: thin;
}
.term .ln { min-height: 1.62em; white-space: pre-wrap; overflow-wrap: anywhere; }
.term .ps { color: var(--cyan); }
.term .ln.head { color: #a9c1ff; font-weight: 600; }
.term .ln.warn { color: var(--amber); }
.term .past { opacity: 0.42; }
.term .sep { height: 1px; margin: 0.9rem 0 0.2rem; background: linear-gradient(90deg, rgba(122, 162, 255, 0.55), rgba(167, 139, 250, 0.3) 40%, transparent); }
.caret {
  display: inline-block;
  width: 0.6em;
  height: 1.2em;
  margin-left: 1px;
  border-radius: 1px;
  background: var(--cyan);
  vertical-align: -0.22em;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.is-paused .caret { animation-play-state: paused; }
.typed.pasted { border-radius: 3px; animation: pasted 1.2s ease-out both; }
@keyframes pasted { from { background: rgba(122, 162, 255, 0.4); } to { background: rgba(122, 162, 255, 0); } }

/* The agent: its messages, its tool calls, and the box you type into. */
.inbox {
  flex: none;
  min-height: 2.9rem;
  margin: 0 0.8rem 0.8rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid rgba(167, 139, 250, 0.38);
  border-radius: 11px;
  background: rgba(167, 139, 250, 0.05);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.term .gt { color: var(--violet); }
.term .msg { margin-top: 0.75rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.term .msg.user { margin-inline: -0.65rem; padding: 0.3rem 0.65rem; border-radius: 8px; background: rgba(255, 255, 255, 0.05); color: var(--fg); }
.term .msg.bot { display: grid; grid-template-columns: 1.5em minmax(0, 1fr); color: #e3e7f3; }
.term .msg.bot .dot { color: var(--fg); }
.term .msg.cont { margin-top: 0.45rem; padding-left: 1.5em; }
.term code { padding: 0.05em 0.35em; border-radius: 5px; background: rgba(94, 234, 212, 0.1); color: var(--cyan); font: inherit; }
.term .tool {
  display: -webkit-box;
  margin-top: 0.4rem;
  overflow: hidden;
  color: var(--muted);
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.term .tool .dot { color: var(--green); }
.term .tool.run .dot { color: var(--dim); animation: pulse 0.9s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }
.term .tool b { color: var(--fg); font-weight: 650; }
.term .tool .arg { color: #aeb6cc; }
.term .spin { margin-top: 0.5rem; color: #f9a8d4; }
.term .spin .g { display: inline-block; animation: turn 2.2s linear infinite; }
@keyframes turn { to { transform: rotate(360deg); } }
.term .tbl {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.12rem 1.3rem;
  padding: 0.55rem 0.85rem;
  border-left: 2px solid rgba(122, 162, 255, 0.55);
  border-radius: 0 9px 9px 0;
  background: rgba(122, 162, 255, 0.06);
}
.term .tbl .k { color: var(--blue); white-space: nowrap; }
.term .tbl .v { min-width: 0; color: var(--fg); }
.term .box { padding: 0.55rem 0.85rem; border: 1px solid rgba(94, 234, 212, 0.32); border-radius: 9px; background: rgba(0, 0, 0, 0.35); color: var(--cyan); }
.term .box.warn { border-color: rgba(251, 191, 36, 0.42); background: rgba(251, 191, 36, 0.06); color: #fcd34d; }
.term .bul { margin: 0.2rem 0 0; padding: 0; list-style: none; }
.term .bul li { position: relative; margin-top: 0.15rem; padding-left: 1.3em; }
.term .bul li::before { content: "–"; position: absolute; left: 0.2em; color: var(--dim); }
.term .pill {
  display: inline-block;
  margin-left: 0.9rem;
  padding: 0 0.55rem;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  color: var(--muted);
  font: 0.72rem/1.6 var(--sans);
  vertical-align: 0.08em;
  white-space: nowrap;
}
/* Shown over a fresh tab, whose few lines are at the top: at the bottom it
   covers none of them. */
.term-screen .note {
  position: absolute;
  bottom: 1.1rem;
  left: 50%;
  z-index: 3;
  width: max-content;
  max-width: calc(100% - 2rem);
  padding: 0.45rem 1rem;
  border: 1px solid rgba(94, 234, 212, 0.42);
  border-radius: 12px;
  background: rgba(8, 28, 30, 0.84);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
  color: var(--cyan);
  font: 600 0.82rem/1.4 var(--sans);
  text-align: center;
  transform: translateX(-50%);
  animation: note-in 0.35s ease-out;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.term-screen .note.out { opacity: 0; transform: translate(-50%, 8px); }
@keyframes note-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* The six steps. Without main.js they are a plain list of cards; with it,
   the current one opens and fills with the demo's progress. */
.steps { display: grid; gap: 0.55rem; margin: 0; padding: 0; list-style: none; }
.demo-grid:not(.has-term) .steps { grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); }
.step {
  position: relative;
  display: grid;
  grid-template-columns: 2.1rem minmax(0, 1fr);
  grid-template-rows: minmax(2.1rem, auto) auto;
  align-items: center;
  column-gap: 0.85rem;
  width: 100%;
  height: 100%;
  padding: 0.8rem 1rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.022);
  color: var(--fg);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.3s, border-color 0.3s;
}
.steps:not(.live) .step { cursor: default; }
.steps.live .step:hover:not(.on) { border-color: var(--line-2); background: rgba(255, 255, 255, 0.04); }
.step .n {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  color: var(--muted);
  font: 700 0.84rem/1 var(--mono);
  transition: color 0.3s, border-color 0.3s;
}
.step .st { font-weight: 650; line-height: 1.35; }
.step .sd { display: grid; grid-template-rows: 1fr; grid-column: 2; margin-top: 0.3rem; color: var(--muted); font-size: 0.9rem; line-height: 1.55; }
.step .sd > span { overflow: hidden; }
.steps.live .step .sd {
  grid-template-rows: 0fr;
  margin-top: 0;
  opacity: 0;
  transition: grid-template-rows 0.45s ease, margin-top 0.45s ease, opacity 0.45s ease;
}
.steps.live .step.on .sd { grid-template-rows: 1fr; margin-top: 0.35rem; opacity: 1; }
.step.on { border-color: rgba(122, 162, 255, 0.42); background: linear-gradient(135deg, rgba(122, 162, 255, 0.11), rgba(167, 139, 250, 0.05)); }
.step.on .n { border-color: transparent; background: var(--grad); color: var(--bg); }
.step.done .n { border-color: rgba(94, 234, 212, 0.45); color: var(--cyan); }
.step::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--grad);
  transform: scaleX(var(--p, 0));
  transform-origin: left;
}
.step.done::after { opacity: 0.35; }
.steps:not(.live) .step::after { content: none; }

/* ---- Cards --------------------------------------------------------------- */

.cards,
.rules { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); gap: 1rem; }
.card,
.rule {
  position: relative;
  min-width: 0;
  padding: 1.5rem 1.5rem 1.6rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.012));
}
.card > *,
.rule > * { position: relative; }
/* A soft light that follows the pointer (main.js sets --mx and --my). */
.card::before,
.rule::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(28rem circle at var(--mx, 50%) var(--my, 0%), rgba(122, 162, 255, 0.13), transparent 42%);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}
.card:hover,
.rule:hover { border-color: rgba(122, 162, 255, 0.32); }
.card:hover::before,
.rule:hover::before { opacity: 1; }
.reveals .card.reveal,
.reveals .rule.reveal {
  transition:
    opacity 0.8s var(--ease) var(--d, 0ms),
    transform 0.8s var(--ease) var(--d, 0ms),
    border-color 0.3s ease;
}
.ic {
  width: 2.7rem;
  height: 2.7rem;
  padding: 0.6rem;
  border: 1px solid rgba(94, 234, 212, 0.22);
  border-radius: 13px;
  background: rgba(94, 234, 212, 0.08);
  fill: none;
  stroke: var(--cyan);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cards .card:nth-child(3n + 2) .ic,
.trio .part:nth-child(2) .ic { border-color: rgba(167, 139, 250, 0.28); background: rgba(167, 139, 250, 0.09); stroke: var(--violet); }
.cards .card:nth-child(3n) .ic,
.trio .part:nth-child(3) .ic { border-color: rgba(244, 114, 182, 0.26); background: rgba(244, 114, 182, 0.08); stroke: var(--pink); }
.card h3,
.rule h3 { margin: 1.05rem 0 0.45rem; font-size: 1.1rem; line-height: 1.3; letter-spacing: -0.01em; }
.card p,
.rule p { margin: 0; color: var(--muted); font-size: 0.95rem; }

.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.card .kicker { margin: 1.05rem 0 0; color: var(--violet); font: 650 0.72rem/1.4 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; }
.part h3 { margin-top: 0.3rem; }
.trio .part:nth-child(2) {
  border-color: rgba(167, 139, 250, 0.36);
  background: linear-gradient(180deg, rgba(167, 139, 250, 0.1), rgba(255, 255, 255, 0.012));
  box-shadow: 0 30px 80px -40px rgba(167, 139, 250, 0.6);
}
.card .chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 1rem; }
.chips code { padding: 0.28em 0.7em; border: 1px solid rgba(167, 139, 250, 0.32); border-radius: 999px; background: rgba(167, 139, 250, 0.1); color: #dcd1ff; font-size: 0.8rem; }

.rule .ic { border-color: rgba(74, 222, 128, 0.24); background: rgba(74, 222, 128, 0.07); stroke: var(--green); }
.rule pre { margin: 0.9rem 0 0; padding: 0.7rem 0.85rem; border: 1px solid var(--line); border-radius: 10px; background: rgba(0, 0, 0, 0.4); }
.rule pre code { padding: 0; background: none; color: var(--cyan); font-size: 0.82rem; white-space: pre-wrap; }
.security .warn {
  display: flex;
  align-items: flex-start;
  gap: 1.1rem;
  margin-top: 1rem;
  padding: 1.35rem 1.5rem;
  border: 1px solid rgba(251, 191, 36, 0.34);
  border-radius: var(--radius);
  background: linear-gradient(100deg, rgba(251, 191, 36, 0.1), rgba(251, 191, 36, 0.02) 60%);
}
.security .warn .ic { flex: none; border-color: rgba(251, 191, 36, 0.36); background: rgba(251, 191, 36, 0.1); stroke: var(--amber); }
.security .warn h3 { margin: 0.15rem 0 0.35rem; color: #fde68a; font-size: 1.1rem; }
.security .warn p { margin: 0; color: var(--muted); }

.agents {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  max-width: 50rem;
  margin: 0 auto 1.8rem;
  padding: 0;
  list-style: none;
}
.agents li {
  padding: 0.5rem 1.05rem;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.92rem;
  font-weight: 600;
  transition: border-color 0.25s, background-color 0.25s;
}
.agents li:hover { border-color: rgba(122, 162, 255, 0.42); background: rgba(122, 162, 255, 0.08); }
.fine { max-width: 46rem; margin: 0.5rem auto 0; color: var(--dim); font-size: 0.9rem; text-align: center; text-wrap: balance; }
.fine a { color: var(--muted); text-underline-offset: 3px; }

.cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  margin-block: clamp(2rem, 5vw, 3rem) clamp(4rem, 9vw, 6.5rem);
  padding: clamp(2.8rem, 7vw, 4.8rem) clamp(1rem, 4vw, 3rem);
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-radius: 28px;
  background:
    radial-gradient(90% 130% at 50% 0%, rgba(122, 162, 255, 0.18), transparent 62%),
    radial-gradient(60% 90% at 90% 100%, rgba(167, 139, 250, 0.13), transparent 60%),
    rgba(255, 255, 255, 0.015);
  text-align: center;
}
.cta h2 { margin: 0; }
.button {
  display: inline-flex;
  align-items: center;
  padding: 0.8rem 1.45rem;
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
}
.button:hover { background: #fff; box-shadow: 0 12px 40px -12px rgba(122, 162, 255, 0.85); transform: translateY(-1px); }
.button .star {
  width: 1.15em;
  height: 1.15em;
  margin-right: 0.55rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
  transition: fill 0.2s, stroke 0.2s, transform 0.35s var(--ease);
}
.button:hover .star { fill: var(--amber); stroke: #b45309; transform: rotate(-14deg) scale(1.15); }
.star-cta { display: flex; flex-direction: column; align-items: center; gap: 0.8rem; }
.star-cta p { max-width: 32rem; margin: 0; color: var(--dim); font-size: 0.9rem; text-wrap: balance; }

.foot { padding: 2.2rem 0 3rem; border-top: 1px solid var(--line); color: var(--dim); font-size: 0.88rem; }
.foot-in { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem 2.5rem; }
.foot-notes { display: grid; gap: 0.7rem; max-width: 42rem; }
.foot-notes p { margin: 0; }
.foot-links { display: flex; flex-wrap: wrap; gap: 0.6rem 1.4rem; margin: 0; }
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--fg); }

/* ---- Chinese, Japanese, Korean ------------------------------------------- */

:is(h1, h2, h3, .asks-label, .kicker):is(:lang(zh), :lang(ja), :lang(ko)) { letter-spacing: 0.02em; }
h1:is(:lang(zh), :lang(ja), :lang(ko)) { font-size: clamp(1.9rem, 0.8rem + 4.9vw, 4.4rem); line-height: 1.22; }
h2:is(:lang(zh), :lang(ja), :lang(ko)) { line-height: 1.32; }
:root:lang(ko) { word-break: keep-all; }
:root:is(:lang(zh), :lang(ja)) { line-break: strict; }

/* ---- Narrow screens ------------------------------------------------------ */

@media (max-width: 1040px) {
  .demo-grid.has-term { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .links { display: none; }
  .trio { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  /* German runs to words wider than a phone. */
  :is(h1, h2):lang(de) { -webkit-hyphens: auto; hyphens: auto; }
  .asks { grid-template-columns: minmax(0, 1fr); }
  .cmd { row-gap: 0.75rem; padding: 0.85rem 0.9rem 0.85rem 1.05rem; }
  .cmd code { flex: 1 1 0; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
  .copy { flex: 1 1 100%; }
  .term-screen { height: 27rem; font-size: 12px; }
  .log { padding: 0.85rem 0.85rem 1rem; }
  .inbox { margin: 0 0.6rem 0.6rem; }
  .security .warn { flex-direction: column; }
}
@media (max-width: 440px) {
  .cmd { font-size: 0.8rem; }
  .cmd .ps { display: none; }
  .dots { display: none; }
  .term-bar { gap: 0.5rem; padding-left: 0.7rem; }
  .tab { padding-inline: 0.5rem; }
  .lang select { max-width: 10.5rem; }
}

/* ---- Less motion ---------------------------------------------------------
   main.js draws each step of the demo still, and skips the scroll reveals. */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .hero > *,
  .orb,
  .grad,
  .term::before,
  .caret,
  .typed.pasted,
  .term .spin .g,
  .term .tool.run .dot,
  .term-screen .note { animation: none; }
  .term-body,
  .steps.live .step .sd,
  .button,
  .button .star { transition: none; }
}
