/* agent-memory homepage: tokens, layout and both themes.
   Matches the approved Figma file H2pQ7piGNpZc5a5kvTRYhB (pages Home, States).
   Token names follow the board UI (web/kanban/src/styles/mockup.css). */

:root {
  color-scheme: light dark;
  --bg: #F6F6F7;
  --surface: #FFFFFF;
  --surface2: #F2F2F4;
  --line: #E4E4E7;
  --line2: #D4D4D8;
  --fg: #18181B;
  --fg2: #52525B;
  --fg3: #6B6B74; /* 4.72:1 on --surface2, 4.88:1 on --bg (WCAG AA) */
  --accent: #4F46E5;
  --accent-hover: #4338CA;
  --accentbg: #EEF0FF;
  --accenttext: #3730A3;
  --onaccent: #FFFFFF;
  --ok: #15803D;
  --okbg: #F0FDF4;
  --danger: #DC2626;
  --dangerbg: #FEF2F2;
  --focus: #4F46E5;
  --scroll: #D4D4D8;
  --scroll-hover: #A1A1AA;

  --gutter: 16px;
  --section-gap: 40px;
  --col-gap: 24px;
  --card-gap: 12px;
  --h1: 2.125rem;
  --h1-lh: 1.18;
  --h2: 1.625rem;
  --lead: 1.0625rem;
  --radius: 12px;
  --text-max: 40rem;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F0F11;
    --surface: #18181B;
    --surface2: #212125;
    --line: #2A2A2F;
    --line2: #3A3A40;
    --fg: #EDEDEF;
    --fg2: #A1A1AA;
    --fg3: #8B8B93;
    --accent: #8B93FF;
    --accent-hover: #A5ABFF;
    --accentbg: #23264A;
    --accenttext: #C7CBFF;
    --onaccent: #0F0F11;
    --ok: #4ADE80;
    --okbg: #0F2A1A;
    --danger: #F87171;
    --dangerbg: #2A1416;
    --focus: #A5ABFF;
    --scroll: #3A3A40;
    --scroll-hover: #71717A;
  }
}

@media (min-width: 600px) {
  :root {
    --gutter: 24px;
    --section-gap: 64px;
    --col-gap: 48px;
    --card-gap: 20px;
    --h1: 3.5rem;
    --h1-lh: 1.1;
    --h2: 2.25rem;
    --lead: 1.1875rem;
  }
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  scrollbar-width: thin;
  scrollbar-color: var(--scroll) transparent;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 1rem/1.5 var(--font);
  overflow-wrap: break-word;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-hover); }
* { scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }
*:hover { scrollbar-color: var(--scroll-hover) transparent; }

h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
code, kbd { font-family: var(--mono); font-size: 0.875rem; }
svg { display: block; flex: none; }

a { color: inherit; }
a, button, summary, [role="button"] { cursor: pointer; }
a *, button * { cursor: inherit; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 10;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--line2);
  border-radius: 8px;
}
.skip:focus { top: 8px; }

/* ---------- header and footer ---------- */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 16px;
  padding: 12px var(--gutter);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.wordmark {
  font-weight: 700;
  font-size: 1.1875rem;
  line-height: 24px;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--fg);
}
.wordmark span { color: var(--accent); }

.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }

.nav a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--fg2);
  font-weight: 500;
  font-size: 0.9375rem;
  line-height: 20px;
  text-decoration: none;
}
.nav a:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }

.site-footer { padding: var(--section-gap) var(--gutter) 20px; }

.site-footer .inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* ---------- sections ---------- */

main { display: block; }

.section {
  container: section / inline-size;
  padding: var(--section-gap) var(--gutter) 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.kicker {
  color: var(--accenttext);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 18px;
  text-transform: uppercase;
}

h1 {
  font-size: var(--h1);
  line-height: var(--h1-lh);
  letter-spacing: -0.03em;
  font-weight: 700;
}

h2 {
  font-size: var(--h2);
  line-height: 1.22;
  letter-spacing: -0.02em;
  font-weight: 700;
  max-width: 47.5rem;
}

h3 { font-size: 1.125rem; line-height: 26px; font-weight: 600; }

.lead { font-size: var(--lead); line-height: 1.53; color: var(--fg2); }
.muted { color: var(--fg2); }
.small { font-size: 0.875rem; line-height: 20px; color: var(--fg3); }

.heading { display: flex; flex-direction: column; gap: 8px; }

/* Two columns from about 960px of section width; one column below. */
.two-col { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--col-gap); align-items: start; }
.col-text { display: flex; flex-direction: column; gap: 20px; min-width: 0; max-width: var(--text-max); }
.col-visual { min-width: 0; }

@container section (min-width: 912px) {
  .two-col { grid-template-columns: minmax(0, var(--text-max)) minmax(min(24rem, 100%), 1fr); }
  .two-col.visual-first { grid-template-columns: minmax(min(24rem, 100%), 1fr) minmax(0, var(--text-max)); }
  .two-col.visual-first .col-visual { order: -1; }
}

.grid {
  display: grid;
  gap: var(--card-gap);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17.5rem), 1fr));
}
.grid.narrow-cards { grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }

/* ---------- pieces ---------- */

.chip {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accentbg);
  color: var(--accenttext);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 16px;
}
.chip.mono { font-family: var(--mono); }
.chip.quiet { background: var(--surface2); color: var(--fg2); }

.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.step-number {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--accentbg);
  color: var(--accenttext);
  font-weight: 700;
  font-size: 0.875rem;
}

.code-line {
  display: block;
  padding: 8px;
  border-radius: 6px;
  background: var(--surface2);
  font-size: 0.8125rem;
  line-height: 18px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.code-line.boxed { padding: 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 0.875rem; line-height: 20px; }

.bullets { display: flex; flex-direction: column; gap: 18px; }
.bullets li { display: flex; gap: 12px; align-items: flex-start; }
.bullets svg { margin-top: 3px; color: var(--accent); }
.bullets strong { display: block; font-weight: 600; }
.bullets p { color: var(--fg2); }

.actions { display: flex; flex-wrap: wrap; gap: 12px; }

.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  font: 600 0.9375rem/20px var(--font);
  text-decoration: none;
}
.button.primary { background: var(--accent); color: var(--onaccent); }
.button.primary:hover { background: var(--accent-hover); }
.button.secondary { background: var(--surface); color: var(--fg); border-color: var(--line2); }
.button.secondary:hover { background: var(--surface2); border-color: var(--fg3); }

/* ---------- copy control ---------- */

.command {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 10px 12px 16px;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 0;
}

.command pre {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding-top: 4px;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.command code { display: block; font-size: 0.875rem; line-height: 22px; }
.command .line { display: block; padding-left: 1.25em; text-indent: -1.25em; user-select: all; }
.command .line::before { content: "$ "; color: var(--fg3); user-select: none; }

.copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--line2);
  background: var(--surface);
  color: var(--fg2);
  font: 500 0.8125rem/18px var(--font);
}
.copy[hidden] { display: none; }
.copy:hover { color: var(--fg); border-color: var(--fg3); }
.copy .when-copied, .copy .when-failed { display: none; }
.copy.is-copied { color: var(--ok); background: var(--okbg); border-color: var(--ok); }
.copy.is-failed { color: var(--danger); background: var(--dangerbg); border-color: var(--danger); }
.copy.is-copied .when-idle, .copy.is-failed .when-idle { display: none; }
.copy.is-copied .when-copied { display: inline-flex; }
.copy.is-failed .when-failed { display: inline-flex; }
.copy span { align-items: center; gap: 6px; }
.copy .when-idle { display: inline-flex; }

/* ---------- demo illustrations (demo data only) ---------- */

.demo {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Three window dots drawn by one pseudo-element and two shadows. */
.window-bar { display: flex; align-items: center; gap: 8px; color: var(--fg3); font: 0.75rem/16px var(--mono); }
.window-bar::before {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  margin-right: 32px;
  border-radius: 50%;
  background: var(--line2);
  box-shadow: 16px 0 0 var(--line2), 32px 0 0 var(--line2);
}

.query { display: flex; gap: 8px; padding: 10px; border-radius: 8px; background: var(--surface2); font: 0.8125rem/20px var(--mono); }
.query b { color: var(--accent); font-weight: 500; }

.memory { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 0.875rem; line-height: 21px; }
.memory .top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 8px; }
.memory .score { color: var(--fg3); font: 0.75rem/16px var(--mono); }
.bar { height: 6px; border-radius: 3px; background: var(--surface2); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.bar .w92 { width: 92%; }
.bar .w78 { width: 78%; }
.bar .w55 { width: 55%; }
.demo-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 8px; color: var(--fg3); font-size: 0.75rem; line-height: 16px; }
.demo-foot .mono { font-family: var(--mono); }

.session { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); font-size: 0.875rem; line-height: 20px; }
.session:last-child { padding-bottom: 0; }
.day { display: inline-grid; place-items: center; flex: none; width: 44px; height: 28px; border-radius: 6px; background: var(--surface2); color: var(--fg2); font-size: 0.75rem; font-weight: 600; }
.session strong { display: block; font-weight: 500; }
.session small { color: var(--fg3); font: 0.75rem/16px var(--mono); }

.board-cols { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(8.125rem, 1fr)); }
.board-col { display: flex; flex-direction: column; gap: 8px; padding: 8px; border-radius: 8px; background: var(--surface2); }
.board-col h4 { margin: 0; color: var(--fg3); font-size: 0.6875rem; line-height: 14px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.task { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-size: 0.8125rem; line-height: 18px; font-weight: 500; }
.task small { color: var(--fg3); font: 0.6875rem/14px var(--mono); }
.task .mini { display: flex; gap: 6px; }
.task .mini i { padding: 3px 8px; border-radius: 5px; font: normal 600 0.6875rem/14px var(--font); }
.task .mini .approve { background: var(--accent); color: var(--onaccent); }
.task .mini .changes { border: 1px solid var(--line2); color: var(--fg2); font-weight: 500; }

.egress { gap: 14px; padding: 20px; }
.egress-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.egress-row strong { display: block; font-weight: 500; font-size: 0.9375rem; line-height: 22px; }
.egress-row span { color: var(--fg2); font-size: 0.8125rem; line-height: 18px; }

.install-steps { display: flex; flex-direction: column; gap: 20px; }
.install-steps > li { display: flex; gap: 12px; align-items: flex-start; }
.install-steps .body { display: flex; flex-direction: column; gap: 10px; flex: 1 1 auto; min-width: 0; }
.install-steps h3 { font-size: 1rem; line-height: 24px; }

.checklist { display: flex; flex-direction: column; gap: 10px; color: var(--fg2); }
.checklist li { display: flex; gap: 10px; align-items: flex-start; }
.checklist svg { color: var(--ok); margin-top: 2px; }
