/* ============================================================
   Neosapien · MCP Guide — design system
   Tokens lifted from Figma (Work Sans, #00f1a0 primary, dark)
   ============================================================ */

@font-face {
  font-family: 'Work Sans';
  src: url('../assets/fonts/worksans-latin.woff2') format('woff2');
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

:root {
  /* palette */
  --primary: #00f1a0;
  --primary-2: #008b5c;
  --back-green: #2df790;

  --text: #ffffff;
  --muted: #868686;
  --muted-2: rgba(255, 255, 255, 0.54);
  --muted-3: rgba(255, 255, 255, 0.5);

  --card: #202423;
  --border: rgba(255, 255, 255, 0.04);
  --border-2: rgba(255, 255, 255, 0.08);
  --border-dashed: rgba(255, 255, 255, 0.14);

  --card-grad: linear-gradient(168deg, #202423 0.1%, #171a19 99.9%);
  --primary-grad: linear-gradient(90deg, #00f1a0 0%, #008b5c 100%);

  /* geometry */
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 10px;

  --pad-x: 16px;
  --maxw: 430px;
  --topbar-h: 50px;

  /* motion — soft, gentle */
  --ease-soft: cubic-bezier(0.22, 0.61, 0.36, 1); /* easeOutCubic */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);      /* soft, slightly floaty */
  --dur-page: 0.5s;
  --dur-swap: 0.34s;
  --dur-tap: 0.2s;

  --font: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--text);
  background: #050505;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

/* Phone-width app frame, centered on large screens */
.screen {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: var(--maxw);
  margin: 0 auto;
  background:
    radial-gradient(120% 90% at 100% 0%, #2b2b2b 0%, rgba(43,43,43,0) 55%),
    linear-gradient(226deg, #1b1c1c 0%, #070707 70%);
  background-attachment: fixed;
  overflow-x: clip; /* clip (not hidden) so position:sticky header/tabs still work */
}
@media (min-width: 460px) {
  .screen {
    box-shadow: 0 0 0 1px rgba(255,255,255,0.05), 0 30px 80px rgba(0,0,0,0.6);
  }
}

/* ---------- top bar (Back | centered title | spacer) ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 8px;
  height: calc(var(--safe-top) + var(--topbar-h));
  padding: var(--safe-top) 12px 0;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: linear-gradient(180deg, rgba(7,7,7,0.86) 0%, rgba(7,7,7,0.5) 70%, rgba(7,7,7,0) 100%);
}
.back {
  grid-column: 1;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 0;
  background: none;
  padding: 6px 6px 6px 0;
  margin: 0;
  color: var(--back-green);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.03em;
  cursor: pointer;
}
.back svg { display: block; }
.back:active { opacity: 0.6; }
.back[hidden] { visibility: hidden; }

.appbar-title {
  grid-column: 2;
  justify-self: center;
  max-width: 100%;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.view {
  padding: 4px var(--pad-x) calc(48px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 36px;
}
.view.home { gap: 36px; }

/* ---------- typography helpers ---------- */
.h-section {
  font-size: 24px;
  font-weight: 500;
  line-height: 28px;
  letter-spacing: -0.04em;
  margin: 0;
  color: var(--text);
}
.sub {
  font-size: 13px;
  font-weight: 400;
  line-height: 18px;
  color: var(--muted-2);
  margin: 0;
}
.section-head { display: flex; flex-direction: column; gap: 6px; }
.section-head.center { align-items: center; text-align: center; }

.grad {
  background: var(--primary-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.muted { color: var(--muted); }

a { color: var(--primary); text-decoration: none; }

/* ---------- hero ---------- */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: var(--r-lg);
  border: 1.2px solid var(--border);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(228,255,240,0.05) 100%),
    #111111;
  box-shadow:
    inset -3.5px -3.5px 10px rgba(0,0,0,0.2),
    inset 3.5px 3.5px 2px rgba(206,206,206,0.06),
    0 0 5px rgba(0,0,0,0.1);
}
/* checkered graph-paper pattern, concentrated at the top and fading out */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.055) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.055) 1px, transparent 1px);
  background-size: 22px 22px;
  background-position: center top;
  -webkit-mask-image: radial-gradient(120% 90% at 50% -10%, #000 0%, rgba(0,0,0,0.55) 38%, transparent 62%);
  mask-image: radial-gradient(120% 90% at 50% -10%, #000 0%, rgba(0,0,0,0.55) 38%, transparent 62%);
}
.hero > * { position: relative; z-index: 1; }
.hero-logos { display: flex; align-items: center; gap: 14px; }
.hero-logos .neo {
  width: 38px; height: 38px;
  border: 1px solid var(--primary);
  border-radius: 5px;
  object-fit: cover;
}
.hero-logos .x { width: 12px; height: 12px; opacity: 0.6; }
.hero-logos .cluster { display: flex; align-items: center; }
.hero-logos .cluster img,
.hero-logos .cluster .mcp {
  width: 46px; height: 46px;
  border-radius: 50%;
  margin-left: -8px;
  filter: drop-shadow(0 0 3px rgba(0,0,0,0.25));
}
.hero-logos .cluster > :first-child { margin-left: 0; }
.hero-logos .cluster .mcp {
  display: grid; place-items: center;
  background: #2a2e2c;
  border: 1.5px solid rgba(255,255,255,0.2);
  color: #fff;
}
.hero-logos .cluster .mcp svg { width: 24px; height: 24px; display: block; }
.hero h1 {
  font-size: 24px; font-weight: 500; line-height: 28px;
  letter-spacing: -0.04em; margin: 0;
}
.hero p {
  font-size: 14px; line-height: 20px; letter-spacing: -0.04em;
  margin: 0; color: var(--muted-3);
}
.hero p b { color: rgba(255,255,255,0.78); font-weight: 500; }

/* ---------- steps strip ---------- */
.steps { display: flex; gap: 10px; }
.step-chip {
  flex: 1 0 0; min-width: 0;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.03);
  border-radius: var(--r-md);
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.step-chip .n {
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0,241,160,0.1);
  color: var(--primary);
  font-size: 10px;
  display: grid; place-items: center;
}
.step-chip span.label {
  font-size: 13px; letter-spacing: -0.04em; opacity: 0.8; line-height: 1.25;
}

/* ---------- AI picker list ---------- */
.ai-list { display: flex; flex-direction: column; gap: 12px; }
.ai-option {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--card-grad);
  color: inherit;
  transition: transform .12s ease, border-color .12s ease;
}
.ai-option:active { transform: scale(0.99); border-color: var(--border-2); }
.ai-option .lead { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ai-option .lead img,
.ai-option .lead .mcp { width: 40px; height: 40px; border-radius: 10px; flex: 0 0 auto; }
.ai-option .lead .mcp { display: grid; place-items: center; color: rgba(255,255,255,0.92); }
.ai-option .lead .mcp svg { width: 30px; height: 30px; display: block; }
.ai-option .copy { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ai-option .copy .name { font-size: 14px; font-weight: 500; letter-spacing: -0.04em; }
.ai-option .copy .desc { font-size: 14px; font-weight: 500; letter-spacing: -0.04em; color: var(--muted); }
.ai-option .cta {
  flex: 0 0 auto;
  font-size: 12px; font-weight: 500; letter-spacing: -0.04em; color: var(--primary);
  white-space: nowrap;
}

.note-line {
  font-size: 13px; line-height: 18px;
  color: rgba(255,255,255,0.8); opacity: 0.5;
}

/* ---------- use-cases card ---------- */
.usecases {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.usecase {
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px 20px;
}
.usecase + .usecase { border-top: 1px dashed var(--border-dashed); }
.usecase .title {
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 500; letter-spacing: -0.04em;
}
.usecase .title .grad { flex: 1; }
.usecase .title .uc-ico {
  width: 15px; height: 15px; flex: 0 0 auto;
  color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
}
.usecase .title .uc-ico svg { width: 100%; height: 100%; display: block; }
.usecase .desc { font-size: 12px; font-weight: 500; letter-spacing: -0.04em; color: var(--muted); }
.usecase .desc b { color: #fff; font-weight: 500; }

/* ---------- link rows ---------- */
.link-card {
  background: var(--card);
  border: 1.2px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.link-row {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 20px; color: inherit;
}
.link-row + .link-row { border-top: 1px solid var(--border); }
.link-row .ico { width: 20px; height: 20px; color: var(--muted); flex: 0 0 auto; }
.link-row .label { flex: 1; font-size: 14px; font-weight: 500; letter-spacing: -0.04em; }
.link-row .chev { width: 18px; height: 18px; color: var(--muted); flex: 0 0 auto; }
.link-row:active { background: rgba(255,255,255,0.02); }

/* ============================================================
   Guide (step-by-step) screens
   ============================================================ */
.tabgroup { display: flex; flex-direction: column; gap: 24px; }

/* segmented tab control (Web / Desktop App / Code) */
.tabbar {
  position: sticky;
  top: calc(var(--safe-top) + var(--topbar-h));
  z-index: 10;
  display: flex;
  gap: 4px;
  padding: 5px;
  background: rgba(16, 18, 17, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
}
.tab {
  flex: 1 0 0; min-width: 0;
  padding: 11px 8px;
  border: 0; border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 15px; font-weight: 500; letter-spacing: -0.03em;
  cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tab.active {
  background: #2d302f;
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.35), inset 0 0 0 1px rgba(255,255,255,0.06);
}
.tab:not(.active):active { color: rgba(255,255,255,0.75); }
.tabpanel { display: flex; flex-direction: column; gap: 20px; }

.blocks { display: flex; flex-direction: column; gap: 20px; }

/* step card — screenshot on top, silver "Step N" label + instruction below */
.step-card {
  background: var(--card);
  border: 1.2px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: 0 0 10px rgba(255,255,255,0.04);
  overflow: hidden;
}
.step-card.no-shot { background: var(--card-grad); }
.card-shot {
  aspect-ratio: 4 / 3;
  background: #fefefe;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.card-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-details { padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.step-label {
  font-size: 16px; font-weight: 500; letter-spacing: -0.04em; line-height: 1.1;
  background: linear-gradient(180deg, #ffffff 0%, #999999 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  width: fit-content;
}
.step-instr { font-size: 16px; letter-spacing: -0.04em; line-height: 1.35; color: var(--text); }
.step-instr b { font-weight: 500; }
.step-instr a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }
.step-instr .grad { -webkit-text-fill-color: transparent; }
.step-instr ul { margin: 0; padding-left: 20px; }

/* standalone image block */
.shot {
  border-radius: var(--r-md);
  border: 1px solid var(--border-2);
  overflow: hidden;
  background: #0c0d0d;
}
.shot img { display: block; width: 100%; height: auto; }
.shot figcaption { font-size: 12px; color: var(--muted); padding: 8px 12px; border-top: 1px solid var(--border); }

/* callout */
.callout {
  border-radius: var(--r-md);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 4px;
  font-size: 13px; line-height: 19px;
  border: 1px solid var(--border-2);
  background: rgba(255,255,255,0.02);
}
.callout .c-title { font-weight: 500; font-size: 14px; letter-spacing: -0.02em; display:flex; align-items:center; gap:8px; }
.callout .c-title .c-ico { width: 16px; height: 16px; flex: 0 0 auto; display: inline-flex; }
.callout .c-title .c-ico svg { width: 100%; height: 100%; display: block; }
.callout .c-body { color: rgba(255,255,255,0.7); }
.callout.info { border-color: rgba(0,241,160,0.2); background: rgba(0,241,160,0.05); }
.callout.info .c-title { color: var(--primary); }
.callout.warning { border-color: rgba(255,196,84,0.25); background: rgba(255,196,84,0.06); }
.callout.warning .c-title { color: #ffc454; }
.callout.success { border-color: rgba(0,241,160,0.25); background: rgba(0,241,160,0.06); }
.callout.success .c-title { color: var(--primary); }

/* code */
.code {
  position: relative;
  background: #0b0c0c;
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  padding: 14px 44px 14px 16px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: #dfe8e4;
  overflow-x: auto;
  white-space: pre;
}
.code .copy-btn {
  position: absolute; top: 8px; right: 8px;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 8px; border: 1px solid var(--border-2);
  background: rgba(255,255,255,0.03); color: var(--muted);
  cursor: pointer;
}
.code .copy-btn:active { color: var(--primary); }

/* standalone image */
figure.image { margin: 0; }

/* ---------- FAQ accordion ---------- */
.faq { display: flex; flex-direction: column; gap: 10px; }
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--card);
  overflow: hidden;
}
.faq-q {
  width: 100%; text-align: left; border: 0; background: none; cursor: pointer;
  color: var(--text); font-family: var(--font);
  font-size: 14px; font-weight: 500; letter-spacing: -0.02em;
  padding: 16px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.faq-q .tw { width: 18px; height: 18px; flex: 0 0 auto; display: inline-flex; transition: transform var(--dur-swap) var(--ease-soft); color: var(--muted); }
.faq-q .tw svg { width: 100%; height: 100%; display: block; }
.faq-item[open] .faq-q .tw { transform: rotate(45deg); color: var(--primary); }
.faq-a {
  max-height: 0; overflow: hidden;
  transition: max-height var(--dur-swap) var(--ease-soft);
  font-size: 13px; line-height: 20px; color: rgba(255,255,255,0.68);
}
.faq-a-inner { padding: 0 18px 16px; }
.faq-item[open] .faq-a { max-height: 600px; }

/* ---------- misc ---------- */
.divider { height: 1px; background: var(--border-dashed); border: 0; margin: 0; }

.loading, .errbox {
  text-align: center; color: var(--muted); padding: 60px 20px; font-size: 14px;
}
.errbox button {
  margin-top: 14px; padding: 10px 18px; border-radius: 10px;
  border: 1px solid var(--border-2); background: rgba(255,255,255,0.03);
  color: var(--primary); font-family: var(--font); font-size: 13px; cursor: pointer;
}

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-bottom));
  transform: translate(-50%, 20px);
  background: #1c1f1e; border: 1px solid var(--border-2);
  color: #fff; font-size: 13px; padding: 10px 16px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============================================================
   Tablet breakpoint — grow to a tablet-width layout (capped),
   two-up cards. Above this we stay at tablet width (no desktop-wide).
   ============================================================ */
@media (min-width: 700px) {
  :root { --maxw: 700px; --pad-x: 28px; }
  .screen { max-width: 700px; }

  .topbar { padding-left: 28px; padding-right: 28px; }
  .view { gap: 44px; }

  /* home: two-up AI list + use cases, wider hero */
  .hero { padding: 36px 32px; }
  .hero h1 { font-size: 28px; line-height: 32px; }

  .ai-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .ai-list .ai-option:last-child:nth-child(odd) { grid-column: 1 / -1; }

  .usecases { display: grid; grid-template-columns: 1fr 1fr; }
  .usecases .usecase { border-top: 0; }
  .usecases .usecase:nth-child(n+3) { border-top: 1px dashed var(--border-dashed); }
  .usecases .usecase:nth-child(even) { border-left: 1px dashed var(--border-dashed); }

  /* guides: two-up step cards, full-width for everything else */
  .tabpanel .blocks { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
  .tabpanel .blocks > :not(.step-card) { grid-column: 1 / -1; }

  .faq { max-width: 620px; }
}
/* ============================================================
   Motion — soft, gentle transitions across interactions
   ============================================================ */
@keyframes fadeRise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }

/* screen entrance: soft fade + rise, gently staggered top-to-bottom */
.view > * { animation: fadeRise var(--dur-page) var(--ease-out) both; }
.view > *:nth-child(1) { animation-delay: 0ms; }
.view > *:nth-child(2) { animation-delay: 50ms; }
.view > *:nth-child(3) { animation-delay: 95ms; }
.view > *:nth-child(4) { animation-delay: 135ms; }
.view > *:nth-child(5) { animation-delay: 170ms; }
.view > *:nth-child(6) { animation-delay: 200ms; }
.view > *:nth-child(n+7) { animation-delay: 230ms; }

/* tab content swap: quick soft cross-fade + tiny rise */
.tabpanel.swap { animation: fadeRise var(--dur-swap) var(--ease-out); }

/* soft, unified interactive feedback */
.ai-option, .link-row, .tab, .faq-q, .back, .step-card,
.copy-btn, .errbox button, .hero-logos .cluster img {
  transition:
    transform var(--dur-tap) var(--ease-soft),
    background-color var(--dur-tap) var(--ease-soft),
    border-color var(--dur-tap) var(--ease-soft),
    color var(--dur-tap) var(--ease-soft),
    opacity var(--dur-tap) var(--ease-soft),
    box-shadow var(--dur-tap) var(--ease-soft);
}
.ai-option:active, .step-card:active { transform: scale(0.985); }
.link-row:active, .faq-q:active { transform: scale(0.994); }
.copy-btn:active { transform: scale(0.9); }

/* faq answer: fade the text in with the expand */
.faq-a-inner { opacity: 0; transition: opacity var(--dur-swap) var(--ease-soft); }
.faq-item[open] .faq-a-inner { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .view > *, .tabpanel.swap, .toast { animation: none !important; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
