/* aibrainmcp.com. Mobile first. */

:root {
  --bg: #f5f3ec;
  --surface: #fffdf7;
  --ink: #141413;
  --ink-2: #4a4843;
  --ink-3: #7d7a72;
  --line: #e2ded2;
  --line-strong: #141413;
  --accent: #d9541e;
  --accent-ink: #fffdf7;
  --free-bg: #dcefd9;
  --free-ink: #1f5a24;
  --pro-bg: #141413;
  --pro-ink: #f4d58d;
  --code-bg: #efece2;
  --shadow: 4px 4px 0 var(--line-strong);
  --radius: 14px;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111110;
    --surface: #1b1a18;
    --ink: #f2efe6;
    --ink-2: #c4c0b5;
    --ink-3: #8d897f;
    --line: #2e2c28;
    --line-strong: #f2efe6;
    --accent: #f06a33;
    --accent-ink: #111110;
    --free-bg: #1f3a21;
    --free-ink: #a8e0a0;
    --pro-bg: #f4d58d;
    --pro-ink: #141413;
    --code-bg: #232220;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; height: auto; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.wrap-narrow { max-width: 760px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 8px; font: 700 17px/1 var(--mono); text-decoration: none; letter-spacing: -0.02em; }
.brand-mark { width: 18px; height: 18px; border-radius: 5px; background: var(--accent); box-shadow: 2px 2px 0 var(--line-strong); }
.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav a { text-decoration: none; font-weight: 500; font-size: 15px; padding: 8px 10px; border-radius: 999px; color: var(--ink-2); }
.site-nav a:hover { color: var(--ink); background: var(--line); }
.site-nav .nav-cta { color: var(--accent-ink); background: var(--ink); }
.site-nav .nav-cta:hover { color: var(--accent-ink); background: var(--accent); }

/* Type */
h1, h2, h3 { line-height: 1.1; letter-spacing: -0.01em; }
h1 { font: 400 clamp(38px, 9vw, 68px)/1.02 var(--serif); margin: 0 0 16px; letter-spacing: -0.02em; }
h1 em { color: var(--accent); }
.eyebrow, .label, .kind {
  font: 700 12px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); margin: 0 0 12px;
}
.lede { font-size: 18px; color: var(--ink-2); margin: 0 0 24px; max-width: 62ch; }
.muted { color: var(--ink-3); }
.fine { font-size: 13px; color: var(--ink-3); margin: 12px 0 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 0 20px;
  font: 600 15px/1 var(--sans); color: var(--ink); text-decoration: none;
  background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: 999px;
  cursor: pointer; transition: transform .12s ease, box-shadow .12s ease, background .12s;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow); }
.btn:active { transform: none; box-shadow: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-sm { min-height: 34px; padding: 0 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; pointer-events: none; }

/* Hero */
.hero { padding: 40px 0 24px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* Filter chips */
.filter { display: flex; gap: 8px; margin: 16px 0 20px; overflow-x: auto; padding-bottom: 4px; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 14px; border-radius: 999px;
  font: 500 14px/1 var(--sans); color: var(--ink-2); text-decoration: none;
  background: transparent; border: 1px solid var(--line); cursor: pointer;
}
.chip span { font: 700 11px/1 var(--mono); color: var(--ink-3); }
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip.is-active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.is-active span { color: var(--bg); opacity: .7; }

/* Tiles */
.grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 20px; } }
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(3, 1fr); } }

.tile {
  display: flex; flex-direction: column; gap: 10px; min-height: 210px;
  padding: 20px; text-decoration: none;
  background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: var(--radius);
  transition: transform .15s ease, box-shadow .15s ease;
}
.tile:hover, .tile:focus-visible { transform: translate(-3px, -3px); box-shadow: var(--shadow); outline: none; }
.tile-top { display: flex; align-items: center; gap: 10px; }
.tile-top .kind { margin: 0; }
.tile-title { font: 400 30px/1.05 var(--serif); margin: 6px 0 0; }
.tile-line { margin: 0; color: var(--ink-2); font-size: 15px; flex: 1; }
.tile-cta { font: 700 13px/1 var(--mono); color: var(--accent); }
.tile.is-hidden { display: none; }

.tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px;
  font: 700 11px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.06em;
}
.tag-free { background: var(--free-bg); color: var(--free-ink); }
.tag-pro { background: var(--pro-bg); color: var(--pro-ink); }

/* Cards */
.card {
  background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.card h2 { font: 400 30px/1.1 var(--serif); margin: 10px 0 8px; }
.card p { margin: 0 0 16px; color: var(--ink-2); }
.band { display: flex; flex-direction: column; gap: 16px; margin: 48px 0; }
.band p { margin: 0; }
@media (min-width: 760px) {
  .band { flex-direction: row; align-items: center; justify-content: space-between; padding: 28px 32px; }
  .band .btn { flex: none; }
}

/* Detail page */
.back { display: inline-block; margin: 24px 0 8px; font: 500 14px/1 var(--sans); color: var(--ink-3); text-decoration: none; }
.back:hover { color: var(--ink); }
.doc-head { padding: 16px 0 8px; }
.doc-head h1 { margin-top: 12px; }
.doc-nav {
  position: sticky; top: 61px; z-index: 5;
  display: flex; gap: 8px; overflow-x: auto; padding: 10px 0; margin: 0 0 8px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.doc-section { padding: 24px 0; border-bottom: 1px solid var(--line); }
.doc-section:last-child { border-bottom: 0; }
.section-title { font: 700 12px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); margin: 0 0 16px; }

.prose { font-size: 17px; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose h1, .prose h2 { font: 400 30px/1.1 var(--serif); margin: 32px 0 12px; }
.prose h3 { font: 600 19px/1.3 var(--sans); margin: 28px 0 8px; }
.prose h4 { font: 600 16px/1.3 var(--sans); margin: 24px 0 8px; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin: 6px 0; }
.prose li > ul, .prose li > ol { margin: 6px 0 0; }
.prose a { color: var(--accent); text-underline-offset: 3px; }
.prose code { font: 500 .88em var(--mono); background: var(--code-bg); padding: 2px 5px; border-radius: 5px; }
.prose pre code { background: none; padding: 0; }
.prose blockquote { margin: 0 0 16px; padding: 4px 0 4px 16px; border-left: 3px solid var(--accent); color: var(--ink-2); font-style: italic; }
.prose blockquote p:last-child { margin: 0; }
.prose hr { border: 0; border-top: 1px dashed var(--line); margin: 28px 0; }
.table-wrap { overflow-x: auto; margin: 0 0 16px; border: 1px solid var(--line); border-radius: 10px; }
.prose table { border-collapse: collapse; width: 100%; font-size: 15px; }
.prose th, .prose td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font: 700 12px/1.2 var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); background: var(--code-bg); }
.prose tr:last-child td { border-bottom: 0; }
.checklist { list-style: none; padding-left: 0 !important; }
.checklist .task label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.checklist input { width: 20px; height: 20px; margin: 3px 0 0; accent-color: var(--accent); flex: none; }

pre {
  margin: 0; padding: 14px 16px; overflow-x: auto;
  font: 500 13.5px/1.55 var(--mono); background: var(--code-bg);
  white-space: pre-wrap; word-break: break-word;
}
.copy-block { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 0 0 16px; }
.copy-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 6px 6px 14px; border-bottom: 1px solid var(--line); background: var(--surface);
  font: 700 12px/1 var(--mono); color: var(--ink-3);
}
.copy-block pre { border-radius: 0; }
.template { border: 1px solid var(--line); border-radius: 10px; margin: 0 0 12px; background: var(--surface); }
.template > summary { padding: 14px 16px; cursor: pointer; font: 600 15px/1.3 var(--mono); }
.template .copy-block { margin: 0 12px 12px; }

/* Pro preview + paywall */
.preview { padding: 16px 0 8px; }
.inside { padding-left: 20px; margin: 0 0 24px; color: var(--ink-2); }
.inside li { margin: 8px 0; }
.paywall { position: relative; margin: 8px 0 48px; }
.paywall::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 80px; pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--bg));
}
.restore { margin-top: 16px; border-top: 1px dashed var(--line); padding-top: 14px; }
.restore summary { cursor: pointer; font-weight: 500; font-size: 14px; color: var(--ink-2); }
.restore-form { display: flex; gap: 8px; margin-top: 12px; }
.restore-form input {
  flex: 1; min-width: 0; min-height: 46px; padding: 0 14px;
  font: 500 14px var(--mono); color: var(--ink);
  background: var(--bg); border: 1.5px solid var(--line); border-radius: 10px;
}
.restore-form input:focus { outline: none; border-color: var(--accent); }
.form-msg { font-size: 14px; margin: 8px 0 0 !important; }
.form-msg.is-error { color: #c0392b; }
.member-note { display: flex; align-items: center; gap: 10px; margin: 8px 0 0; padding: 10px 14px; border-radius: 10px; background: var(--free-bg); color: var(--free-ink); font-size: 14px; font-weight: 500; }

/* Connect + welcome */
.key-card { margin: 8px 0 16px; }
.key-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.key-row .label { margin-bottom: 8px; }
.key { font: 700 15px/1.4 var(--mono); word-break: break-all; }
.key-row.big { margin: 20px 0 24px; padding: 16px; background: var(--code-bg); border-radius: 10px; }
.key-row.big .key { font-size: 17px; }
.welcome { margin: 40px 0 64px; }
.welcome h1 { font-size: clamp(34px, 8vw, 52px); }
[data-key] { color: var(--accent); }

.form-card { margin: 8px 0 0; padding: 8px; overflow: hidden; }
.ghl-form { display: block; width: 100%; min-height: 380px; border: 0; border-radius: 10px; background: #fff; }
.ghl-placeholder {
  min-height: 280px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  border: 2px dashed var(--line); border-radius: 10px; padding: 24px;
}

/* Footer */
.site-footer { max-width: 1120px; margin: 40px auto 0; padding: 24px 16px calc(32px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); font-size: 14px; color: var(--ink-2); }
.site-footer p { margin: 0 0 6px; }
.site-footer a { color: var(--ink-2); }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 500;
  z-index: 50; opacity: 0; transition: opacity .2s;
}
.toast.is-on { opacity: 1; }

@media (min-width: 760px) {
  .hero { padding: 72px 0 32px; }
  .card { padding: 28px; }
  .tile { padding: 24px; }
  .site-header { padding-left: 24px; padding-right: 24px; }
}

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