/* ============ tokens ============ */
:root {
  --bg: #0b0d10;
  --bg-2: #11151a;
  --panel: #13181e;
  --line: #222a33;
  --text: #e6edf3;
  --muted: #9aa7b4;
  --accent: #7ee787; /* agent green */
  --accent-2: #a5b4fc; /* indigo for links/tool calls */
  --warn: #f2cc60;
  --radius: 12px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f8fa;
    --bg-2: #eef1f4;
    --panel: #ffffff;
    --line: #d9dee4;
    --text: #0f1720;
    --muted: #4b5866;
    --accent: #137333;
    --accent-2: #3b47c4;
    --warn: #8a5a00;
    color-scheme: light;
  }
  /* terminal stays dark in both themes */
  .term {
    --panel: #0f1318;
    --line: #262e38;
    --text: #e6edf3;
    --muted: #9aa7b4;
    --accent: #7ee787;
    --accent-2: #a5b4fc;
    --warn: #f2cc60;
  }
}

/* ============ base ============ */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--line) 70%, transparent) 1px, transparent 0);
  background-size: 24px 24px;
}
h1, h2, h3 { line-height: 1.15; margin: 0; letter-spacing: -0.02em; }
p { margin: 0 0 1rem; }
a { color: var(--accent-2); text-underline-offset: 3px; }
img { max-width: 100%; height: auto; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.mono { font-family: var(--mono); }
.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 16px; top: -48px; z-index: 100;
  background: var(--accent); color: #000; padding: 8px 12px; border-radius: 8px;
}
.skip:focus { top: 12px; }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }

/* ============ nav ============ */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; gap: 24px; height: 60px; }
.logo { color: var(--text); text-decoration: none; font-weight: 700; font-size: 15px; }
.prompt { color: var(--accent); }
.caret {
  display: inline-block; width: 8px; height: 1em; margin-left: 3px; vertical-align: -2px;
  background: var(--accent);
}
.nav-links { display: flex; gap: 4px; list-style: none; margin: 0 0 0 auto; padding: 0; }
.nav-links a {
  color: var(--muted); text-decoration: none; font: 500 14px var(--mono);
  padding: 6px 10px; border-radius: 8px;
}
.nav-links a:hover { color: var(--text); background: var(--bg-2); }
.kbd-btn {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--panel); color: var(--muted); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 8px 6px 12px; font-size: 13px; cursor: pointer;
}
.kbd-btn:hover { color: var(--text); }
kbd {
  font: 500 11px var(--mono); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 6px; color: var(--muted);
}

/* ============ hero ============ */
.hero {
  display: grid; grid-template-columns: 1fr 1.05fr; gap: 48px; align-items: center;
  padding-block: 72px 56px;
}
.status {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted);
  border: 1px solid var(--line); background: var(--panel);
  padding: 4px 12px; border-radius: 999px; margin-bottom: 20px;
}
.dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}
.hero h1 { font-size: clamp(40px, 6vw, 64px); font-weight: 700; margin-bottom: 16px; }
.lede { font-size: 18px; color: var(--muted); max-width: 54ch; }
.lede strong { color: var(--text); font-weight: 600; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0 32px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 42px; padding: 0 16px; border-radius: 10px;
  font: 500 14px var(--sans); text-decoration: none; cursor: pointer;
  color: var(--text); background: var(--panel); border: 1px solid var(--line);
  transition: border-color 0.15s, transform 0.15s;
}
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--accent); color: #04140a; border-color: transparent; font-weight: 600; }
.btn-primary:hover { border-color: transparent; filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.metrics {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin: 0;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.metrics div { background: var(--panel); padding: 14px 16px; }
.metrics dt { font: 400 12px/1.3 var(--mono); color: var(--muted); }
.metrics dd { margin: 6px 0 0; font-size: 22px; font-weight: 700; }

/* ============ terminal ============ */
.term {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
  overflow: hidden; color: var(--text); min-width: 0;
}
.term-bar {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 85%, #000);
}
.lights { display: inline-flex; gap: 6px; }
.lights i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.lights i:nth-child(2) { background: #febc2e; }
.lights i:nth-child(3) { background: #28c840; }
.term-title { font-size: 12px; color: var(--muted); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge {
  font-size: 11px; color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent);
  padding: 1px 8px; border-radius: 999px;
}
.term-body {
  height: 340px; overflow-y: auto; padding: 16px 18px; font-size: 13px; line-height: 1.65;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.term-body p { margin: 0; white-space: pre-wrap; word-break: break-word; }
.t-user { color: var(--text); margin-top: 10px !important; }
.t-user::before { content: "❯ "; color: var(--accent); }
.t-tool { color: var(--accent-2); }
.t-tool::before { content: "⏺ "; }
.t-res { color: var(--muted); padding-left: 18px; }
.t-res::before { content: "⎿ "; margin-left: -18px; }
.t-ans { color: var(--text); padding-left: 18px; }
.t-dim { color: var(--muted); }
.t-ok { color: var(--accent); }
.term-body a { color: var(--accent-2); }
.term-input {
  display: flex; align-items: center; gap: 10px; padding: 10px 18px;
  border-top: 1px solid var(--line);
}
.term-input label { display: flex; }
.term-input input {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: 0;
  color: var(--text); font: 400 14px var(--mono);
}
.term-input:focus-within { box-shadow: inset 0 0 0 1px var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 14px; }
.chips button {
  font: 400 12px var(--mono); color: var(--muted); background: transparent;
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; cursor: pointer;
}
.chips button:hover { color: var(--text); border-color: var(--muted); }

/* ============ sections ============ */
.section { padding-block: 72px; border-top: 1px solid var(--line); }
.sec-head { margin-bottom: 32px; }
.eyebrow { color: var(--accent); font-size: 13px; margin-bottom: 8px; }
.section h2 { font-size: clamp(28px, 4vw, 40px); }
.tags { font-size: 12px; color: var(--muted); margin: 12px 0 0; }

/* trace timeline */
.trace { list-style: none; margin: 0; padding: 0; position: relative; }
.trace::before {
  content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 1px; background: var(--line);
}
.step { position: relative; padding: 0 0 36px 36px; }
.step::before {
  content: ""; position: absolute; left: 2px; top: 6px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--muted);
}
.step.live::before { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 20%, transparent); }
.step-meta { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.ok { color: var(--accent); }
.done { color: var(--muted); }
.step h3 { font-size: 19px; font-weight: 600; margin-bottom: 10px; }
.step h3 span { color: var(--muted); font-weight: 500; }
.step h3 em { font-style: normal; font: 400 12px var(--mono); color: var(--muted); margin-left: 6px; }
.step ul { margin: 0; padding-left: 18px; color: var(--muted); max-width: 75ch; }
.step li { margin-bottom: 4px; }
.step li strong { color: var(--text); font-weight: 600; }

/* cards */
.cards { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.card {
  grid-column: span 2; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column;
  transition: border-color 0.2s, transform 0.2s;
}
.card.feature { grid-column: span 3; }
.card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.card-kind { font-size: 12px; color: var(--accent); margin-bottom: 10px; }
.card h3 { font-size: 20px; margin-bottom: 10px; }
.card h3 a { color: var(--text); text-decoration: none; }
.card h3 a:hover { color: var(--accent-2); }
.card p { color: var(--muted); font-size: 15px; }
.card .tags { margin-top: auto; padding-top: 8px; }
.stat { color: var(--text) !important; font-size: 13px !important; }
.stat b { font-size: 28px; color: var(--accent); margin-right: 4px; }
.more { margin-top: 20px; font-size: 13px; }

/* stack */
.stack { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stack > div { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.stack h3 { font-size: 13px; font-weight: 500; color: var(--accent); margin-bottom: 12px; }
.stack ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.stack li {
  font-size: 13px; padding: 3px 10px; border-radius: 6px;
  background: var(--bg-2); border: 1px solid var(--line);
}

/* about */
.about { display: grid; grid-template-columns: 300px 1fr; gap: 48px; align-items: start; }
.portrait { border-radius: var(--radius); border: 1px solid var(--line); aspect-ratio: 1; object-fit: cover; }
.about p { color: var(--muted); max-width: 65ch; font-size: 17px; }
.edu { margin: 24px 0 0; display: grid; gap: 10px; }
.edu div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.edu dt { font-weight: 500; }
.edu dd { margin: 0; color: var(--muted); font-size: 13px; }

/* contact */
.contact { text-align: center; }
.contact .lede { margin-inline: auto; margin-top: 12px; }
.contact .cta { justify-content: center; }
.toast { min-height: 1.5em; color: var(--accent); font-size: 13px; }

.footer {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding-block: 28px 40px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted);
}
.footer p { margin: 0; }

/* ============ command palette ============ */
.palette {
  width: min(560px, 100% - 32px); padding: 0; border: 1px solid var(--line);
  border-radius: 14px; background: var(--panel); color: var(--text);
  margin-top: 12vh; box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.7);
}
.palette::backdrop { background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(2px); }
.palette input {
  width: 100%; padding: 16px 18px; background: transparent; border: 0;
  border-bottom: 1px solid var(--line); color: var(--text); font-size: 15px; outline: 0;
}
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: 320px; overflow-y: auto; }
.palette li {
  display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px;
  border-radius: 8px; cursor: pointer; font-size: 14px;
}
.palette li span:last-child { font: 400 12px var(--mono); color: var(--muted); }
.palette li[aria-selected="true"] { background: var(--bg-2); box-shadow: inset 2px 0 0 var(--accent); }
.palette-hint { font-size: 11px; color: var(--muted); padding: 8px 16px; margin: 0; border-top: 1px solid var(--line); }

/* ============ motion (opt-in) ============ */
@media (prefers-reduced-motion: no-preference) {
  .caret { animation: blink 1.1s steps(1) infinite; }
  .dot { animation: pulse 2.4s ease-in-out infinite; }
  .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s ease; }
  .reveal.in { opacity: 1; transform: none; }
  .card:hover { transform: translateY(-2px); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
@keyframes blink { 50% { opacity: 0; } }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 6%, transparent); } }

/* ============ responsive ============ */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; padding-top: 48px; }
  .cards { grid-template-columns: 1fr 1fr; }
  .card, .card.feature { grid-column: span 1; }
  .stack { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .nav-links { display: none; }
  .kbd-btn { margin-left: auto; }
  .kbd-btn kbd { display: none; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .cards, .stack { grid-template-columns: 1fr; }
  .about { grid-template-columns: 1fr; gap: 24px; }
  .portrait { max-width: 220px; }
  .term-body { height: 300px; }
  .section { padding-block: 56px; }
}
