/* Meerkat landing page. Colours follow the app (ui/src/index.css): dark by default, light by OS preference. */
:root {
  color-scheme: dark;
  --bg: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #232322;
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.16);
  --grid: #2c2c2a;
  --grid-line: rgba(255, 255, 255, 0.045);
  --text: #ffffff;
  --text-2: #c3c2b7;
  --muted: #a3a19a;
  --accent: #3987e5;
  --accent-text: #6aa6ee;
  --btn: #226cc4;
  --btn-hover: #1d5aa8;
  --btn-ink: #ffffff;
  --code-bg: #141413;
  --good: #0ca30c;
  --glow: rgba(57, 135, 229, 0.22);
  --shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.6), 0 8px 20px -8px rgba(0, 0, 0, 0.5);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f9f9f7;
    --surface: #ffffff;
    --surface-2: #f0efec;
    --border: rgba(11, 11, 11, 0.12);
    --border-strong: rgba(11, 11, 11, 0.16);
    --grid: #e1e0d9;
    --grid-line: rgba(11, 11, 11, 0.05);
    --text: #0b0b0b;
    --text-2: #52514e;
    --muted: #5f5e5a;
    --accent: #2a78d6;
    --accent-text: #1f63b5;
    --btn: #226cc4;
    --btn-hover: #1d5aa8;
    --code-bg: #f3f2ee;
    --good: #0a8f0a;
    --glow: rgba(42, 120, 214, 0.16);
    --shadow: 0 24px 60px -16px rgba(20, 30, 50, 0.22), 0 8px 20px -10px rgba(20, 30, 50, 0.16);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 0.5em; text-wrap: balance; }
h1 { font-size: clamp(2.5rem, 6.4vw, 4.4rem); letter-spacing: -0.035em; line-height: 1.04; }
h2 { font-size: clamp(1.65rem, 3.2vw, 2.35rem); letter-spacing: -0.025em; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
a { color: var(--accent-text); }
a:focus-visible, .btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
code { font-family: var(--mono); font-size: 0.88em; background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 4px; overflow-wrap: anywhere; }
figure { margin: 0; }
img { max-width: 100%; height: auto; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--btn); color: var(--btn-ink); padding: 8px 14px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }

.wrap { max-width: 1208px; margin: 0 auto; padding: 0 24px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.bar { display: flex; align-items: center; gap: 24px; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; font-weight: 650; font-size: 1.1rem; letter-spacing: -0.01em; margin: 0; }
.brand-icon { width: 22px; height: 22px; color: var(--accent); flex: none; }
.nav { display: flex; gap: 22px; margin-left: auto; }
.nav a { color: var(--text-2); text-decoration: none; font-size: 0.93rem; }
.nav a:hover { color: var(--text); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 22px; border-radius: 8px; background: var(--btn); color: var(--btn-ink); font-weight: 600; font-size: 0.97rem; text-decoration: none; border: 1px solid transparent; transition: background-color 0.15s; }
.btn:hover { background: var(--btn-hover); }
.btn-ghost { background: color-mix(in srgb, var(--surface) 60%, transparent); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-small { min-height: 36px; padding: 0 14px; font-size: 0.9rem; }

/* Hero */
.hero { position: relative; padding: 84px 0 72px; isolation: isolate; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 46% at 50% 0%, var(--glow), transparent 72%),
    linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 56px 56px,
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 10%, #000 40%, transparent 100%);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 10%, #000 40%, transparent 100%);
}
.hero-copy { max-width: 860px; margin: 0 auto; text-align: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 9px; padding: 5px 14px 5px 12px; margin-bottom: 26px; border: 1px solid var(--border-strong); border-radius: 999px; background: color-mix(in srgb, var(--surface) 70%, transparent); color: var(--text-2); font-size: 0.9rem; font-weight: 550; }
.pulse { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; }
.pulse::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--good); opacity: 0; animation: pulse 2.4s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(0.5); opacity: 0.7; } 100% { transform: scale(1.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pulse::after { animation: none; } }
.lede { font-size: 1.16rem; color: var(--text-2); max-width: 64ch; margin: 0 auto; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 30px 0; }
.hero .cta, .cta-center { justify-content: center; }
.install-label { font-size: 0.9rem; color: var(--muted); margin-bottom: 8px; }
.hero .code-inline { max-width: 820px; margin: 0 auto; text-align: left; }

.hero-shot { margin: 60px auto 0; max-width: 1110px; }
.hero-shot .frame { box-shadow: 0 0 0 1px var(--border), 0 40px 120px -30px var(--glow), var(--shadow); }
.hero-shot figcaption { margin-top: 14px; text-align: center; font-size: 0.85rem; color: var(--muted); }

/* Browser-style frame around screenshots */
.frame { position: relative; border: 1px solid var(--border-strong); border-radius: 12px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.frame img { display: block; width: 100%; height: auto; }
.frame-bar { display: flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.frame-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--grid); flex: none; }
.frame-bar span { margin: 0 auto; padding: 2px 14px; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 6px; background: var(--bg); color: var(--muted); font: 12px/1.6 var(--mono); transform: translateX(-17px); }

/* Facts under the hero */
.facts { list-style: none; margin: 64px auto 0; padding: 0; max-width: 1110px; display: grid; grid-template-columns: repeat(4, 1fr); }
.facts li { padding: 4px 24px; border-left: 1px solid var(--border); }
.facts li:first-child { border-left: 0; padding-left: 0; }
.facts strong { display: block; font-size: 1.35rem; letter-spacing: -0.02em; margin-bottom: 2px; }
.facts span { display: block; color: var(--text-2); font-size: 0.92rem; line-height: 1.45; }

/* Sections */
.section { padding: 96px 0; scroll-margin-top: 60px; }
.section-alt { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-lede { color: var(--text-2); font-size: 1.08rem; max-width: 68ch; margin-bottom: 36px; }
.kicker { color: var(--accent-text); font-size: 0.8rem; font-weight: 650; letter-spacing: 0.09em; text-transform: uppercase; margin-bottom: 12px; }

/* Product tour: text beside a screenshot, sides alternating */
#tour { scroll-margin-top: 60px; }
.tour + .tour { padding-top: 24px; }
.tour-grid { display: grid; grid-template-columns: 4.4fr 7.6fr; gap: 64px; align-items: center; }
.tour-grid > * { min-width: 0; }
.tour-flip .tour-grid { grid-template-columns: 7.6fr 4.4fr; }
.tour-flip .tour-copy { order: 2; }
.tour-copy p { color: var(--text-2); }
.tour-shot { position: relative; }
.tour-shot::before { content: ""; position: absolute; inset: -12% -10%; z-index: -1; background: radial-gradient(closest-side, var(--glow), transparent); pointer-events: none; }
.tour { isolation: isolate; overflow-x: clip; }
.shot-stack { padding-bottom: 15%; }
.frame-overlay { position: absolute; right: -20px; bottom: 0; width: 64%; box-shadow: 0 0 0 1px var(--border), var(--shadow), 0 30px 70px -20px rgba(0, 0, 0, 0.45); }

.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 72px; }
.duo-item figcaption { margin-bottom: 16px; color: var(--text-2); font-size: 0.95rem; max-width: 52ch; }
.duo-item figcaption strong { color: var(--text); }

.ticks { list-style: none; padding: 0; margin: 0 0 1em; }
.ticks li { position: relative; padding-left: 26px; margin-bottom: 8px; color: var(--text-2); }
.ticks li::before { content: ""; position: absolute; left: 3px; top: 0.55em; width: 11px; height: 6px; border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); }

.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 22px 22px 8px; }
.section:not(.section-alt) .card { background: var(--surface); }
.card h3::before { content: ""; display: block; width: 28px; height: 3px; border-radius: 2px; background: var(--accent); margin-bottom: 14px; }
.card p { color: var(--text-2); font-size: 0.95rem; }

/* Diagram */
.diagram { margin: 0 0 36px; }
.diagram svg { width: 100%; height: auto; display: block; }
.diagram-narrow { display: none !important; max-width: 420px; margin: 0 auto; }
.d-box { fill: var(--bg); stroke: var(--border); stroke-width: 1.5; }
.d-accent { stroke: var(--accent); stroke-width: 2; }
.d-title { fill: var(--text); font: 600 15px var(--font); }
.d-sub { fill: var(--text-2); font: 13px var(--font); }
.d-col { fill: var(--muted); font: 600 12px var(--font); letter-spacing: 0.08em; text-transform: uppercase; }
.d-line { fill: none; stroke: var(--accent); stroke-width: 1.8; }
.d-head { fill: var(--accent); }

.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 28px; }
.steps li { counter-increment: step; color: var(--text-2); font-size: 0.97rem; padding-left: 40px; position: relative; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font-weight: 600; font-size: 0.85rem; display: grid; place-items: center; }
.steps strong { color: var(--text); }

/* Split sections with code */
.split { display: grid; grid-template-columns: 1fr 1.15fr; gap: 56px; align-items: start; }
.split > * { min-width: 0; }
.split p { color: var(--text-2); }
.split p strong { color: var(--text); }

.code-title { font-size: 0.85rem; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.code { background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; margin: 0 0 12px; overflow-x: auto; font: 13.5px/1.65 var(--mono); color: var(--text); }
.code code { background: none; padding: 0; font-size: inherit; overflow-wrap: normal; }
.code-inline { padding: 12px 16px; font-size: 13px; }
.c-k { color: var(--accent-text); }
.c-p { color: var(--muted); user-select: none; }
.note { font-size: 0.88rem; }

.fact { margin-top: 28px; border-left: 3px solid var(--accent); padding: 4px 0 4px 18px; max-width: 80ch; }
.fact p { color: var(--text-2); margin: 0; }
.fact strong { color: var(--text); }

.closing { text-align: center; position: relative; isolation: isolate; }
.closing::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(50% 70% at 50% 100%, var(--glow), transparent 70%); }
.closing-icon { width: 44px; height: 44px; color: var(--accent); margin-bottom: 14px; }
.closing-inner p { color: var(--text-2); max-width: 56ch; margin: 0 auto 8px; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 32px 0; }
.foot { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; }
.foot nav { display: flex; gap: 20px; }
.foot nav a { color: var(--text-2); text-decoration: none; }
.foot nav a:hover { color: var(--text); text-decoration: underline; }
.brand-foot { font-size: 1rem; }
.small { font-size: 0.85rem; color: var(--muted); margin: 0 0 0 auto; max-width: 52ch; }

/* Responsive */
@media (max-width: 960px) {
  .split, .tour-grid, .tour-flip .tour-grid { grid-template-columns: 1fr; gap: 36px; }
  .tour-flip .tour-copy { order: 0; }
  .hero { padding-top: 56px; }
  .facts { grid-template-columns: 1fr 1fr; gap: 24px 0; }
  .facts li:nth-child(3) { border-left: 0; padding-left: 0; }
  .frame-overlay { right: -8px; width: 70%; }
  .duo { margin-top: 48px; }
  /* Section links move to a second, horizontally scrollable row (no script needed). */
  .bar { flex-wrap: wrap; height: auto; gap: 0 16px; justify-content: space-between; }
  .site-header { padding-top: 10px; }
  .nav { order: 3; flex: 1 0 100%; margin: 0; gap: 20px; overflow-x: auto; white-space: nowrap; padding: 8px 0 10px; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 4px 0; }
  .section, #tour { scroll-margin-top: 110px; }
}
@media (max-width: 720px) {
  .diagram-wide { display: none !important; }
  .diagram-narrow { display: block !important; }
  .duo { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  .section { padding: 64px 0; }
  .grid { grid-template-columns: 1fr; }
  .cta .btn { flex: 1 1 auto; }
  .hero-shot { margin-top: 44px; }
  .frame-bar { height: 28px; }
  .frame-bar i { width: 8px; height: 8px; }
  .frame-bar span { font-size: 11px; max-width: 70%; }
  .facts { margin-top: 48px; }
  .facts li { padding: 0 0 0 16px; }
  .shot-stack { padding-bottom: 0; }
  .frame-overlay { position: relative; right: auto; width: 84%; margin: -6% -4px 0 auto; }
  .small { margin-left: 0; }
}
