:root {
  --bg: #0E1014;
  --panel: #12151B;
  --panel-2: #171B23;
  --line: #222731;
  --line-soft: #1C2029;
  --chip: #2C323D;
  --text: #E6E8EC;
  --text-2: #B8BFCB;
  --muted: #A3ABB8;
  --faint: #7D8696;
  --accent: #5B9BFF;
  --signal: #FFA552;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Instrument Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--text); text-decoration: none; }
a:hover { color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
em { font-style: italic; color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 32px; }
section { padding-top: 48px; padding-bottom: 48px; }
.mono { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.signal { color: var(--signal); }
.accent { color: var(--accent); }

/* Nav */
.site-header { border-bottom: 1px solid var(--line); }
.nav { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; padding-top: 22px; padding-bottom: 22px; }
.brand { font-family: var(--serif); font-size: 22px; font-weight: 600; display: flex; gap: 10px; align-items: center; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.nav-links { display: flex; flex-wrap: wrap; gap: 28px; font-size: 15px; }
.nav-links a { color: var(--muted); }
.nav-links a:hover { color: var(--text); }

/* Hero */
.hero { padding-top: 104px; padding-bottom: 72px; display: flex; flex-direction: column; gap: 30px; }
.trace-meta { display: flex; flex-wrap: wrap; gap: 18px; }
h1 { margin: 0; font-family: var(--serif); font-size: clamp(44px, 7vw, 92px); line-height: 1; font-weight: 400; letter-spacing: -0.025em; max-width: 1000px; }
.lede { margin: 0; font-size: 20px; line-height: 1.6; color: var(--text-2); max-width: 720px; }
.ctas { display: flex; flex-wrap: wrap; gap: 14px; padding-top: 8px; }
.btn { display: inline-flex; align-items: center; min-height: 48px; padding: 0 24px; border-radius: 8px; font-size: 16px; font-weight: 500; border: 1px solid #3A414D; }
.btn-primary { background: var(--accent); color: #0B0D11; border-color: var(--accent); font-weight: 600; }
.btn-primary:hover { color: #0B0D11; filter: brightness(1.08); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-top: 40px; }
.stat { background: var(--panel); padding: 24px; display: flex; flex-direction: column; gap: 6px; }
.stat strong { font-family: var(--serif); font-size: 40px; font-weight: 400; }
.stat span { font-size: 15px; color: var(--muted); }

/* Headings */
.section-label { margin: 0 0 28px; font-size: 14px; font-weight: 600; letter-spacing: 0.08em; color: var(--muted); }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 28px; }
h2 { margin: 0; font-family: var(--serif); font-size: 48px; font-weight: 400; letter-spacing: -0.02em; }
h3 { margin: 0; font-family: var(--serif); font-weight: 400; }

/* Cards */
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.grid-oss { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 26px; display: flex; flex-direction: column; gap: 12px; }
.card h3 { font-size: 24px; }
.card p { margin: 0; font-size: 15px; line-height: 1.6; color: var(--muted); }
code { font-family: var(--mono); font-size: 13px; }

.case { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.case-figure { height: 160px; background: var(--panel-2); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: center; }
.case-body { padding: 26px; display: flex; flex-direction: column; gap: 14px; flex: 1; }
.case-num { font-family: var(--serif); font-size: 18px; color: var(--accent); }
.case h3 { font-size: 28px; line-height: 1.15; }
.case p { margin: 0; font-size: 15px; line-height: 1.6; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; font-family: var(--mono); font-size: 12px; }
.chips span { border: 1px solid var(--chip); border-radius: 6px; padding: 4px 8px; color: var(--text-2); }
.case-result { display: flex; gap: 20px; padding-top: 12px; margin-top: auto; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 13px; color: var(--muted); }

.oss { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.oss:hover { border-color: #3A414D; }
.oss-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.oss-name { font-family: var(--serif); font-size: 22px; }
.oss-desc { font-size: 15px; line-height: 1.55; color: var(--muted); }

/* Journey trace */
.trace { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 0; }
.span { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; padding: 16px 24px; border-bottom: 1px solid var(--line-soft); }
.span:last-child { border-bottom: 0; }
.span-label { flex: 0 0 240px; display: flex; flex-direction: column; gap: 2px; }
.span-label strong { font-family: var(--serif); font-size: 19px; font-weight: 400; }
.span-label span { font-size: 13px; color: var(--muted); }
.span-track { flex: 1 1 320px; height: 10px; background: #1A1E26; border-radius: 5px; position: relative; }
.span-bar { position: absolute; top: 0; height: 10px; border-radius: 5px; background: #4A5568; left: var(--start); width: var(--len); }
.span-bar.prev { background: var(--accent); opacity: 0.6; }
.span-bar.live { background: var(--signal); }

/* Ask */
.ask-intro { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.ask-intro p { margin: 0; font-size: 17px; color: var(--muted); }
.chat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.msg-user { align-self: flex-end; background: #1E2430; border-radius: 10px; padding: 12px 16px; font-size: 15px; max-width: 80%; }
.msg-bot { background: var(--panel-2); border-radius: 10px; padding: 14px 16px; font-size: 15px; line-height: 1.6; color: #C9CFD9; max-width: 90%; }
.ask-form { display: flex; gap: 10px; margin-top: auto; }
.ask-form input { flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--chip); border-radius: 8px; padding: 12px 14px; color: var(--text); font-size: 15px; font-family: inherit; }
.ask-form button { background: var(--accent); color: #0B0D11; border: 0; border-radius: 8px; padding: 0 18px; min-height: 44px; font-weight: 600; font-size: 15px; font-family: inherit; cursor: pointer; }
.trace-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px 24px; font-family: var(--mono); font-size: 13px; display: flex; flex-direction: column; gap: 12px; }
.trace-row { display: flex; justify-content: space-between; gap: 12px; }

/* Footer */
.site-footer { padding-top: 80px; padding-bottom: 64px; display: flex; flex-direction: column; gap: 22px; }
.site-footer h2 { font-size: clamp(36px, 5vw, 64px); line-height: 1.05; max-width: 860px; }
.copyright { font-size: 14px; color: var(--faint); padding-top: 32px; }

@media (max-width: 640px) {
  .wrap { padding: 0 20px; }
  h2 { font-size: 36px; }
  .hero { padding-top: 64px; }
  .span-label { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
