/* DemoReady design tokens and shared primitives (landing, app, share page). */
:root {
  --bg: #f7f7f4;
  --surface: #ffffff;
  --surface-2: #f1f1ec;
  --surface-3: #e9e9e2;
  --line: #e2e2da;
  --line-strong: #cfcfc5;
  --text: #16171d;
  --muted: #5f6270;
  --faint: #8d909c;
  --accent: #5b4cff;
  --accent-hover: #4a3bf0;
  --accent-ink: #ffffff;
  --accent-soft: #ecebff;
  --accent-text: #4636e8;
  --rec: #ef3b4f;
  --ok: #0f7a55;
  --ok-soft: #e0f4ea;
  --warn: #9a5a00;
  --warn-soft: #fdf0d9;
  --err: #c0283b;
  --err-soft: #fce6e9;
  --ink: #0d0e13;
  --ink-2: #16171f;
  --shadow-sm: 0 1px 2px rgba(22, 23, 29, .06);
  --shadow: 0 1px 2px rgba(22, 23, 29, .04), 0 10px 30px -8px rgba(22, 23, 29, .10);
  --shadow-lg: 0 24px 60px -16px rgba(22, 23, 29, .28);
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Bricolage Grotesque", "Inter", ui-sans-serif, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0f13; --surface: #16171d; --surface-2: #1c1d25; --surface-3: #24252f; --line: #282a34; --line-strong: #363846;
    --text: #ececf1; --muted: #a2a5b3; --faint: #737685;
    --accent: #7b6fff; --accent-hover: #8c82ff; --accent-soft: #211f3d; --accent-text: #a79fff;
    --ok: #4fcf9c; --ok-soft: #10251c; --warn: #f0b457; --warn-soft: #2a2011; --err: #ff7b8b; --err-soft: #2d1418;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 12px 32px -8px rgba(0,0,0,.5); --shadow-lg: 0 24px 60px -16px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0f13; --surface: #16171d; --surface-2: #1c1d25; --surface-3: #24252f; --line: #282a34; --line-strong: #363846;
  --text: #ececf1; --muted: #a2a5b3; --faint: #737685;
  --accent: #7b6fff; --accent-hover: #8c82ff; --accent-soft: #211f3d; --accent-text: #a79fff;
  --ok: #4fcf9c; --ok-soft: #10251c; --warn: #f0b457; --warn-soft: #2a2011; --err: #ff7b8b; --err-soft: #2d1418;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 12px 32px -8px rgba(0,0,0,.5); --shadow-lg: 0 24px 60px -16px rgba(0,0,0,.7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.55 var(--font); font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: -.015em; }
p { margin: 0; }
a { color: var(--accent-text); }
button, input, textarea, select { font: inherit; color: inherit; }
img, video, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Logo */
.logo-mark { display: inline-block; width: 26px; height: 26px; border-radius: 8px; background: var(--accent); position: relative; flex: none;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.18); }
.logo-mark::after { content: ""; position: absolute; left: 9px; top: 7px; border-left: 11px solid #fff; border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.logo-mark::before { content: ""; position: absolute; right: -3px; top: -3px; width: 9px; height: 9px; border-radius: 50%; background: var(--rec);
  box-shadow: 0 0 0 2px var(--bg); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 19px;
  letter-spacing: -.02em; color: var(--text); text-decoration: none; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 14px; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .08s, box-shadow .15s; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 6px 16px -6px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.dark { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--err); }
.btn.danger.solid { background: var(--err); border-color: var(--err); color: #fff; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.lg { height: 48px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn.icon { width: 34px; padding: 0; }
.btn .spinner { width: 14px; height: 14px; }

.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 18px; min-width: 0; border: 0; padding: 0; }
.field > .label, .field > legend { font-weight: 600; font-size: 13px; color: var(--text); padding: 0; display: flex; align-items: center; gap: 8px; }
.field .hint { color: var(--muted); font-size: 12.5px; }
.field .opt { color: var(--faint); font-weight: 500; }
.input, input[type=text], input[type=url], input[type=email], input[type=password], input[type=search], textarea, select {
  width: 100%; min-height: 40px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 9px 12px; outline: none; resize: vertical; transition: border-color .15s, box-shadow .15s; }
textarea { line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--faint); }
.input:focus, input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=color] { width: 44px; height: 40px; padding: 4px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); cursor: pointer; }
.form-error { color: var(--err); font-size: 13.5px; margin: -4px 0 14px; }
.form-error:empty { display: none; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 5px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; transition: background .15s, color .15s; }
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.switch input { appearance: none; width: 36px; height: 21px; border-radius: 999px; background: var(--line-strong); position: relative; cursor: pointer;
  transition: background .15s; flex: none; margin: 0; }
.switch input::after { content: ""; position: absolute; left: 3px; top: 3px; width: 15px; height: 15px; border-radius: 50%; background: #fff;
  transition: transform .18s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(15px); }

/* Surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.err { background: var(--err-soft); color: var(--err); }
.pill.accent { background: var(--accent-soft); color: var(--accent-text); }
.pill.rec::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--rec); animation: blink 1.2s infinite; }
.pill.run::before { content: ""; width: 10px; height: 10px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes blink { 50% { opacity: .25; } }
kbd, code { font-family: var(--mono); font-size: .9em; }
code { background: var(--surface-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 6px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* Tier switch on a grouped pricing card (e.g. MCP 10 / 30 demos) */
.tier-switch { display: flex; gap: 2px; padding: 3px; margin: 2px 0 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.tier-switch label { flex: 1; position: relative; }
.tier-switch input { position: absolute; opacity: 0; pointer-events: none; }
.tier-switch span { display: block; text-align: center; padding: 5px 8px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.tier-switch input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.tier-switch input:focus-visible + span { outline: 2px solid var(--accent); }
