/* Opsyn intro page. Tokens mirror src/ui/tokens.css (dark default, light by system preference). */
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0f131a;
  --bg-deep: #0b0e14;
  --panel: #161c25;
  --surface-raised: #1e2531;
  --surface-inset: #0c1016;
  --hover: #263040;
  --line: #242c39;
  --line-strong: #3d4a5d;
  --text: #e6ebf3;
  --text-strong: #f5f8fc;
  --muted: #929eb0;
  --hint: #808b9c;
  --accent: #7fe0c6;
  --accent-hover: #a0ecd8;
  --accent-ink: #0b3a2f;
  --accent-soft: #7fe0c61f;
  --accent-text: #7fe0c6;
  --warning: #f2c46d;
  --warning-soft: #f2c46d1f;
  --success: #8ad9a0;
  --success-soft: #8fd19e1f;
  --danger: #f0a0a3;
  --danger-soft: #eaa1a11f;
  --info: #6cc7f0;
  --data-cpu: #7fe0c6;
  --data-mem: #a3afff;
  --data-disk: #f2c46d;
  --data-net: #6cc7f0;
  --data-track: #ffffff12;
  --terminal-bg: #0a0e14;
  --terminal-text: #d9e0ea;
  --terminal-muted: #7f8b9c;
  --hl-prompt: #7fe0c6;
  --hl-cwd: #7fb4ff;
  --hl-path: #6fd8d0;
  --hl-command: #8fe0a8;
  --hl-warning: #f2c46d;
  --hl-success: #8fe0a8;
  --edge-highlight: inset 0 1px 0 #ffffff0d;
  --panel-gradient: linear-gradient(180deg, #1a212c 0%, #161c25 64%);
  --glow-live: 0 0 0 1px #7fe0c62e, 0 24px 80px -24px #7fe0c62e;
  --shot-shadow: 0 30px 80px -30px #000000cc;

  --font-ui: "Segoe UI", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --fast: 150ms;
  --slow: 600ms;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #eef2f6;
    --bg-deep: #e6ecf2;
    --panel: #ffffff;
    --surface-raised: #f0f4f7;
    --surface-inset: #f7f9fb;
    --hover: #e3eaf0;
    --line: #d3dbe4;
    --line-strong: #adbccb;
    --text: #1c2b3a;
    --text-strong: #0e1a26;
    --muted: #566779;
    --hint: #58697b;
    --accent: #0f7f69;
    --accent-hover: #0b6956;
    --accent-ink: #ffffff;
    --accent-soft: #d6efe8;
    --accent-text: #0b6352;
    --warning: #8f5b00;
    --warning-soft: #f6ecd6;
    --success: #276d45;
    --success-soft: #e0f0e6;
    --danger: #b63341;
    --danger-soft: #f7e1e3;
    --info: #1f65a8;
    --data-cpu: #0f8f75;
    --data-mem: #5a63d6;
    --data-disk: #b07a10;
    --data-net: #1f7fb8;
    --data-track: #1c2b3a14;
    --terminal-bg: #fbfcfd;
    --terminal-text: #1f2d3b;
    --terminal-muted: #5c6d7c;
    --hl-prompt: #0f7f69;
    --hl-cwd: #1f5fbf;
    --hl-path: #0c7a78;
    --hl-command: #1d7a3e;
    --hl-warning: #8a5a00;
    --hl-success: #1d7a3e;
    --edge-highlight: inset 0 1px 0 #ffffff;
    --panel-gradient: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
    --glow-live: 0 0 0 1px #0f7f6926, 0 24px 80px -30px #0f7f6940;
    --shot-shadow: 0 30px 70px -36px #0e1a2659;
  }
}
/* A choice made with the theme button wins over the system setting. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef2f6;
  --bg-deep: #e6ecf2;
  --panel: #ffffff;
  --surface-raised: #f0f4f7;
  --surface-inset: #f7f9fb;
  --hover: #e3eaf0;
  --line: #d3dbe4;
  --line-strong: #adbccb;
  --text: #1c2b3a;
  --text-strong: #0e1a26;
  --muted: #566779;
  --hint: #58697b;
  --accent: #0f7f69;
  --accent-hover: #0b6956;
  --accent-ink: #ffffff;
  --accent-soft: #d6efe8;
  --accent-text: #0b6352;
  --warning: #8f5b00;
  --warning-soft: #f6ecd6;
  --success: #276d45;
  --success-soft: #e0f0e6;
  --danger: #b63341;
  --danger-soft: #f7e1e3;
  --info: #1f65a8;
  --data-cpu: #0f8f75;
  --data-mem: #5a63d6;
  --data-disk: #b07a10;
  --data-net: #1f7fb8;
  --data-track: #1c2b3a14;
  --terminal-bg: #fbfcfd;
  --terminal-text: #1f2d3b;
  --terminal-muted: #5c6d7c;
  --hl-prompt: #0f7f69;
  --hl-cwd: #1f5fbf;
  --hl-path: #0c7a78;
  --hl-command: #1d7a3e;
  --hl-warning: #8a5a00;
  --hl-success: #1d7a3e;
  --edge-highlight: inset 0 1px 0 #ffffff;
  --panel-gradient: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  --glow-live: 0 0 0 1px #0f7f6926, 0 24px 80px -30px #0f7f6940;
  --shot-shadow: 0 30px 70px -36px #0e1a2659;
}


*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; touch-action: manipulation; }
section[id] { scroll-margin-top: 72px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.7 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { color: var(--accent-hover); }
code, pre { font-family: var(--font-mono); font-size: 0.875em; font-variant-ligatures: none; }
p code, li code, .msg code {
  padding: 1px 6px;
  border-radius: var(--r-sm);
  background: var(--surface-raised);
  color: var(--text-strong);
  overflow-wrap: anywhere;
}
h1, h2, h3 { color: var(--text-strong); font-weight: 600; margin: 0; text-wrap: balance; }
h2 { font-size: clamp(26px, 3.2vw, 36px); line-height: 1.25; letter-spacing: -0.01em; }
h3 { font-size: 16px; line-height: 1.4; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }

.wrap { width: min(1120px, 100% - 48px); margin-inline: auto; }
.skip { position: absolute; left: 16px; top: -48px; padding: 8px 12px; background: var(--accent); color: var(--accent-ink); border-radius: var(--r-sm); z-index: 10; }
.skip:focus { top: 12px; }

/* ── Top bar ─────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.top-row { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text-strong); }
.brand:hover { color: var(--text-strong); }
.brand-icon { width: 32px; height: 32px; }
.brand-word { width: 76px; height: 24px; }
.brand-s { stroke: var(--accent); }
.top-nav { display: flex; align-items: center; gap: 4px; }
.top-nav a, .lang {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 36px; padding: 0 12px;
  border-radius: var(--r-sm);
  color: var(--muted); font-size: 14px;
  transition: color var(--fast), background-color var(--fast);
}
.top-nav a:hover, .lang:hover { color: var(--text-strong); background: var(--hover); }
.icon-link { width: 36px; padding: 0 !important; }
.icon-link svg { width: 18px; height: 18px; }
.lang {
  border: 1px solid var(--line); background: transparent; cursor: pointer;
  font: 600 12px/1 var(--font-ui); letter-spacing: 0.04em; margin-left: 4px; min-width: 40px;
}

/* ── Hero ────────────────────────────────────────── */
.hero { padding: 88px 0 0; text-align: center; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.lede { max-width: 640px; margin: 24px auto 0; color: var(--muted); font-size: 17px; text-wrap: pretty; }
.actions { display: flex; justify-content: center; gap: 12px; margin-top: 32px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 20px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface-raised); color: var(--text-strong);
  font-size: 15px; font-weight: 600;
  transition: background-color var(--fast), border-color var(--fast), transform var(--fast);
}
.btn:hover { color: var(--text-strong); background: var(--hover); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.meta { margin-top: 16px; color: var(--hint); font-size: 13px; font-variant-numeric: tabular-nums; }

.shot { margin: 0; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shot-shadow); background: var(--surface-inset); }
.shot-hero { margin-top: 56px; border-radius: var(--r-lg); box-shadow: var(--glow-live), var(--shot-shadow); }

/* ── Features ────────────────────────────────────── */
.feature { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 56px; align-items: center; padding: 120px 0 0; }
.feature.flip .feature-text { order: 2; }
.feature-text p:not(.kicker) { margin-top: 16px; color: var(--muted); text-wrap: pretty; }
.kicker { color: var(--accent-text); font: 400 13px/1 var(--font-mono); margin-bottom: 12px; }
.points { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 8px; }
.points li { position: relative; padding-left: 20px; color: var(--text); font-size: 15px; }
.points li::before { content: ""; position: absolute; left: 2px; top: 0.7em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.shot-pair { display: grid; gap: 16px; }
.shot-pair .shot:last-child { margin-left: 12%; margin-top: -18%; }

/* ── Agents ──────────────────────────────────────── */
.agents { margin-top: 96px; padding: 96px 0; background: var(--bg-deep); border-block: 1px solid var(--line); }
.agents-head { max-width: 720px; }
.agents-head p:not(.kicker) { margin-top: 16px; color: var(--muted); }

.dialog-demo {
  margin-top: 48px; padding: 32px;
  display: grid; gap: 16px;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--panel-gradient); box-shadow: var(--edge-highlight);
}
.demo-note { color: var(--hint); font-size: 12px; margin-bottom: 4px; }
.msg { max-width: min(560px, 88%); padding: 12px 16px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-inset); font-size: 15px; }
.msg p + p, .msg pre { margin-top: 4px; }
.msg pre { margin-top: 8px; padding: 8px 12px; border-radius: var(--r-sm); background: var(--bg-deep); border: 1px solid var(--line); overflow-x: auto; }
.msg pre code { padding: 0; background: none; }
.from-agent { justify-self: end; background: var(--surface-raised); }
.from-opsyn { justify-self: start; }
.from-opsyn.concern { border-color: color-mix(in srgb, var(--warning) 45%, var(--line)); }
.from-opsyn.done { border-color: color-mix(in srgb, var(--success) 40%, var(--line)); }
.who { display: flex; align-items: center; gap: 8px; color: var(--hint); font-size: 12px; margin-bottom: 4px; }
.who code { font-size: 12px; background: transparent; padding: 0; color: var(--hint); }
.tag { padding: 0 8px; border-radius: var(--r-sm); font-size: 12px; line-height: 20px; }
.tag.warn { background: var(--warning-soft); color: var(--warning); }
.tag.ok { background: var(--success-soft); color: var(--success); }

.agent-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; margin-top: 56px; }
.agent-grid p { margin-top: 8px; color: var(--muted); font-size: 15px; }
.agent-grid .hint { color: var(--hint); font-size: 13px; }
.cmd {
  display: flex; align-items: center; gap: 8px; margin-top: 16px;
  padding: 8px 8px 8px 12px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface-inset);
}
.cmd code { flex: 1; min-width: 0; font-size: 13px; color: var(--text-strong); overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.copy {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px;
  border: 0; border-radius: var(--r-sm); background: transparent; color: var(--muted); cursor: pointer;
  transition: color var(--fast), background-color var(--fast);
}
.copy:hover { background: var(--hover); color: var(--text-strong); }
.copy svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.copy.done { color: var(--success); }
.shot-wide { margin-top: 56px; }

/* ── More ────────────────────────────────────────── */
.more { padding: 120px 0 0; }
.more-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px 40px; margin-top: 40px; }
.shots-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 56px; }
.shots-note { margin-top: 12px; color: var(--hint); font-size: 13px; text-align: center; }
.more-grid p { margin-top: 8px; color: var(--muted); font-size: 15px; }

/* ── Safety ──────────────────────────────────────── */
.safety { margin-top: 120px; padding: 96px 0; border-block: 1px solid var(--line); background: var(--bg-deep); }
.safety-list { list-style: none; padding: 0; margin: 40px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 48px; counter-reset: s; }
.safety-list li { counter-increment: s; position: relative; padding: 16px 0 0 40px; border-top: 1px solid var(--line); color: var(--text); font-size: 15px; }
.safety-list li::before {
  content: counter(s, decimal-leading-zero); position: absolute; left: 0; top: 16px;
  color: var(--accent-text); font: 400 13px/1.9 var(--font-mono);
}

/* ── Download ────────────────────────────────────── */
.download { padding: 120px 0 96px; text-align: center; }
.dl-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; max-width: 760px; margin: 40px auto 0; }
.dl {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 24px 16px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--panel-gradient); box-shadow: var(--edge-highlight);
  transition: border-color var(--fast), background-color var(--fast);
}
.dl:hover { border-color: var(--line-strong); }
.dl.soon { cursor: default; opacity: 0.72; }
.dl.soon:hover { border-color: var(--line); }
.dl-soon { margin-top: 4px; padding: 0 8px; border-radius: var(--r-sm); background: var(--surface-raised); color: var(--muted); font-size: 12px; line-height: 20px; }
.dl.suggested { border-color: var(--accent); box-shadow: var(--edge-highlight), 0 0 0 1px var(--accent); }
.dl-os { color: var(--text-strong); font-size: 18px; font-weight: 600; }
.dl-sub { color: var(--hint); font-size: 13px; }
.unsigned { max-width: 760px; margin: 24px auto 0; text-align: left; color: var(--muted); font-size: 14px; }
.unsigned summary { cursor: pointer; text-align: center; color: var(--hint); font-size: 13px; }
.unsigned summary:hover { color: var(--muted); }
.unsigned ul { margin: 16px 0 0; padding-left: 20px; display: grid; gap: 8px; }
.unsigned b { color: var(--text); font-weight: 600; }

/* ── Footer ──────────────────────────────────────── */
.foot { border-top: 1px solid var(--line); padding: 24px 0 40px; }
.foot-row { display: flex; gap: 24px; flex-wrap: wrap; align-items: center; color: var(--hint); font-size: 13px; }
.foot-row span { color: var(--text-strong); font-weight: 600; margin-right: auto; }
.foot-row a { color: var(--muted); }
.foot-row a:hover { color: var(--text-strong); }

/* ── Narrow screens ──────────────────────────────── */
@media (max-width: 900px) {
  .feature { grid-template-columns: minmax(0, 1fr); gap: 32px; padding-top: 88px; }
  .feature.flip .feature-text { order: 0; }
  .agent-grid, .more-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .safety-list { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .wrap { width: calc(100% - 32px); }
  .hero { padding-top: 56px; }
  .top-nav a:not(.icon-link) { display: none; }
  .agent-grid, .more-grid, .dl-grid { grid-template-columns: minmax(0, 1fr); }
  .dialog-demo { padding: 16px; }
  .msg { max-width: 94%; }
  .shot-pair .shot:last-child { margin: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
}

/* English is the default: hide the Chinese source text until main.js swaps it in */
html[data-boot] [data-i18n]{visibility:hidden}
