:root {
  color-scheme: light;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #eef4f8;
  --text: #0f172a;
  --muted: #526175;
  --line: #d9e2ec;
  --amber: #d97706;
  --amber-bright: #f59e0b;
  --cyan: #0369a1;
  --emerald: #047857;
  --error: #b91c1c;
  --shadow: 0 18px 60px rgb(15 23 42 / 12%);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #050811;
  --surface: #0d1627;
  --surface-2: #111f34;
  --text: #f8fafc;
  --muted: #9eb0c6;
  --line: #24344b;
  --amber: #f59e0b;
  --amber-bright: #fbbf24;
  --cyan: #38bdf8;
  --emerald: #10b981;
  --error: #f87171;
  --shadow: 0 24px 80px rgb(0 0 0 / 45%);
}

* { box-sizing: border-box; }

html { max-width: 100%; overflow-x: clip; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
}

button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.skip-link {
  position: fixed;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  background: var(--text);
  color: var(--bg);
  padding: .7rem 1rem;
}
.skip-link:focus { top: 1rem; }

.topbar, main, footer { width: min(1180px, calc(100% - 2rem)); margin-inline: auto; }
.topbar {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand { display: inline-flex; align-items: center; gap: .75rem; color: inherit; text-decoration: none; }
.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(145deg, var(--amber-bright), var(--amber));
  color: #101827;
  font-weight: 900;
  box-shadow: 0 8px 26px color-mix(in srgb, var(--amber) 30%, transparent);
}
.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); margin-top: .08rem; }

.switches, .segmented, .actions, .hero-badges, .links { display: flex; gap: .55rem; flex-wrap: wrap; }
.segmented { padding: .25rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.segmented button { border: 0; border-radius: 999px; padding: .45rem .75rem; color: var(--muted); background: transparent; cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(260px, .75fr);
  gap: 2rem;
  padding: 5rem 0 3rem;
  align-items: end;
}
.hero > *, .demo-grid > *, .trust-grid > * { min-width: 0; }
.eyebrow { margin: 0 0 .65rem; color: var(--cyan); font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1 { max-width: 820px; margin: 0; font-size: clamp(2.7rem, 6vw, 5.8rem); line-height: .98; letter-spacing: -.055em; }
h2 { margin: 0; font-size: clamp(1.4rem, 2vw, 2rem); letter-spacing: -.025em; }
.lede { max-width: 760px; color: var(--muted); font-size: 1.15rem; line-height: 1.65; }
.badge { border: 1px solid var(--line); border-radius: 999px; padding: .45rem .75rem; background: var(--surface); font-size: .85rem; }
.badge.synthetic { color: var(--emerald); border-color: color-mix(in srgb, var(--emerald) 42%, var(--line)); }
.impact-card, .chat-panel, .state-panel, .trust-grid article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.impact-card { padding: 1.5rem; }
.impact-card p { color: var(--muted); }
.impact-card strong { display: block; font-size: 1.25rem; line-height: 1.4; }

.demo-grid { display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(340px, .82fr); gap: 1rem; align-items: start; }
.chat-panel, .state-panel { padding: clamp(1rem, 3vw, 2rem); }
.panel-head { display: flex; justify-content: space-between; gap: 1rem; align-items: start; }
.runtime { padding: .4rem .65rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.runtime[data-state="ready"] { color: var(--emerald); }
.runtime[data-state="blocked"] { color: var(--error); }
.transcript { min-height: 180px; max-height: 440px; overflow: auto; margin: 1.25rem 0; padding: 1rem; background: var(--surface-2); border-radius: 18px; }
.message { display: grid; grid-template-columns: 34px 1fr; gap: .7rem; margin-bottom: .8rem; }
.message > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--cyan); color: var(--surface); font-size: .72rem; font-weight: 900; }
.message.user > span { background: var(--amber-bright); color: #03111d; }
.message p { margin: .3rem 0; line-height: 1.5; }
label { display: block; margin: .8rem 0 .45rem; color: var(--muted); font-size: .86rem; font-weight: 700; }
textarea, input { width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: .85rem 1rem; background: var(--surface); color: var(--text); }
textarea:focus, input:focus, button:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--cyan) 40%, transparent); outline-offset: 2px; }
textarea:focus-visible, input:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid var(--cyan); outline-offset: 3px;
}
.form-feedback { padding: 1rem; border: 2px solid currentColor; border-radius: 10px; line-height: 1.6; }
.form-feedback::before { content: "! "; font-weight: 900; }
.form-feedback:focus { outline: 3px solid var(--cyan); outline-offset: 3px; }
button { border: 0; border-radius: 12px; padding: .75rem 1rem; cursor: pointer; font-weight: 800; }
button:disabled { opacity: .55; cursor: wait; }
.primary { background: linear-gradient(135deg, var(--amber-bright), var(--amber)); color: #141922; }
.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.actions { margin-top: .8rem; }

.status-list { list-style: none; padding: 0; margin: 1.25rem 0; display: grid; gap: .65rem; }
.status-list li { display: grid; grid-template-columns: 34px 1fr auto; gap: .7rem; align-items: center; padding: .7rem; border-radius: 14px; background: var(--surface-2); }
.status-list li > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); }
.status-list small { color: var(--muted); }
.status-list li[data-state="done"] > span { background: var(--emerald); color: var(--surface); border-color: transparent; }
.status-list li[data-state="active"] > span { background: var(--amber-bright); color: #17120a; border-color: transparent; }
.status-list li[data-state="blocked"] > span { background: var(--error); color: var(--surface); border-color: transparent; }
.status-list li[data-state="simulated"] > span { background: var(--cyan); color: var(--surface); border-color: transparent; }
.folder-state { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin: 1rem 0; }
.folder-state section { padding: .8rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.folder-state h3 { margin: 0 0 .5rem; font-size: .82rem; }
.folder-state ul { margin: 0; padding-left: 1.1rem; color: var(--muted); font-size: .82rem; line-height: 1.5; overflow-wrap: anywhere; }
.plan-view, .results { margin: 1rem 0; border-top: 1px solid var(--line); padding-top: 1rem; }
.plan-view code { overflow-wrap: anywhere; color: var(--cyan); }
.plan-step { padding: .65rem 0; border-bottom: 1px solid var(--line); }
.plan-step small { display: block; color: var(--muted); margin-top: .25rem; }
.plan-preview { line-height: 1.6; overflow-wrap: anywhere; }
.plan-preview h3 { font-size: 1.05rem; }
.plan-preview li { margin-block: .5rem; }
.result-row { padding: .7rem 0; border-bottom: 1px solid var(--line); }
.result-row .result-name { display: block; color: var(--text); overflow-wrap: anywhere; }
.technical-details { margin-top: .75rem; color: var(--muted); }
.technical-details summary { cursor: pointer; font-weight: 700; }
.technical-details code { overflow-wrap: anywhere; }
.technical-details .links { padding: .75rem 0 0; }
.result-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: .4rem; }
.result-actions a { color: var(--cyan); }

.trust-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0; }
.trust-grid article { padding: 1.5rem; box-shadow: none; }
.trust-grid ul { color: var(--muted); line-height: 1.7; padding-left: 1.25rem; }
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; margin-top: 1.2rem; }
.flow span { padding: .55rem .75rem; background: var(--surface-2); border-radius: 10px; }
.flow b { color: var(--muted); }
.links { align-items: center; padding: 1rem 0 3rem; }
.links a, .links span { color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: .55rem .8rem; text-decoration: none; }
.links a:hover { color: var(--cyan); }
footer { border-top: 1px solid var(--line); padding: 1rem 0 3rem; color: var(--muted); }

@media (max-width: 850px) {
  .hero, .demo-grid, .trust-grid { grid-template-columns: 1fr; }
  .hero { padding-top: 3rem; }
  .topbar { align-items: flex-start; padding-top: 1rem; }
  .switches { justify-content: flex-end; }
}

/* Optional calm view: retain every task, confirmation and safety statement. */
:root[data-view="calm"] { --shadow: none; }
:root[data-view="calm"] body { background: var(--bg); }
:root[data-view="calm"] .hero { padding-top: 1.5rem; padding-bottom: 1.5rem; }
:root[data-view="calm"] h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.2; letter-spacing: normal; }
:root[data-view="calm"] .lede { max-width: 65ch; }
:root[data-view="calm"] .eyebrow { color: var(--muted); letter-spacing: .02em; text-transform: none; }
:root[data-view="calm"] .brand-mark,
:root[data-view="calm"] .message > span,
:root[data-view="calm"] .status-list li > span { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); box-shadow: none; }
:root[data-view="calm"] .primary { background: var(--text); color: var(--surface); }
:root[data-view="calm"] .badge.synthetic { color: var(--text); border-color: var(--line); }
:root[data-view="calm"] .impact-card strong { font-weight: 600; }
:root[data-view="calm"] p { line-height: 1.7; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media (max-width: 560px) {
  .topbar { flex-direction: column; }
  .switches { justify-content: flex-start; }
  .panel-head { display: block; }
  .runtime { display: inline-block; margin-top: .8rem; }
  h1 { max-width: 100%; font-size: clamp(2.2rem, 11vw, 2.8rem); overflow-wrap: break-word; }
  .lede { max-width: 100%; font-size: 1rem; overflow-wrap: break-word; }
  .hero-badges .badge { max-width: 100%; white-space: normal; }
  .folder-state { grid-template-columns: 1fr; }
  .status-list li { grid-template-columns: 34px 1fr; }
  .status-list small { grid-column: 2; }
}
