/* ════════════════════════════════════════════════════════════════
   kymo.studio — "living diagram paper"
   Brand (docs/brand): pink #E0095F · navy #242131 · teal #DDECEE
   Fonts per docs/brand: SF Pro Rounded (display) · Inter (body) · JetBrains Mono
   ════════════════════════════════════════════════════════════════ */
:root {
  --paper:         #fcfcfd;
  --bg:            #ffffff;
  --bg-soft:       #f7f7fa;
  --bg-raise:      #efeef4;
  --border:        #e8e6ef;
  --border-strong: #d2cfde;
  --ink:           #242131;
  --dim:           #6e6a7c;
  --accent:        #e0095f;
  --accent-deep:   #c70854;
  --accent-soft:   rgba(224, 9, 95, 0.07);
  --teal:          #ddecee;
  --radius:        16px;
  --max:           1240px;
  --pad:           24px;
  --display: "SF Pro Rounded", ui-rounded, "Inter", -apple-system, system-ui, sans-serif;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; color-scheme: light; }
html, body {
  margin: 0; padding: 0;
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
/* graph paper: the whole site sits on a dotted grid, like the editor canvas */
body {
  background:
    radial-gradient(circle at 50% 0%, rgba(224, 9, 95, 0.05), transparent 36%),
    radial-gradient(circle, #e6e3ee 1px, transparent 1px) 0 0 / 30px 30px,
    var(--paper);
}
::selection { background: rgba(224, 9, 95, 0.16); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: var(--mono); }
h1, h2, h3, .brand { font-family: var(--display); }

/* ── Motion primitives ───────────────────────────────────────── */
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes bob { 50% { transform: translateY(-12px); } }
@keyframes dashflow { to { stroke-dashoffset: -34; } }

/* ── Nav ─────────────────────────────────────────────────────── */
nav {
  position: sticky; top: 0; z-index: 10;
  background: rgba(252, 252, 253, 0.8);
  backdrop-filter: saturate(160%) blur(12px);
}
.nav-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 22px var(--pad);
  display: flex; align-items: center; justify-content: space-between;
}
.brand {
  font-weight: 800; font-size: 26px;
  display: flex; align-items: center; gap: 12px;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.brand img { width: 42px; height: 42px; display: block; }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-gh {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 12px 10px 18px;
  border-radius: 999px;
  background: var(--ink); color: #fff;
  font-size: 15px; font-weight: 700;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.nav-gh:hover {
  text-decoration: none; transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(36, 33, 49, 0.25);
}
.nav-gh:active { transform: translateY(0) scale(0.98); }
.nav-gh svg { display: block; }
.nav-gh-count {
  background: var(--teal); color: var(--ink);
  border-radius: 999px;
  padding: 2px 11px;
  font-size: 13.5px; font-weight: 700;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  white-space: nowrap;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14.5px; font-weight: 600;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease,
    box-shadow 0.2s ease, color 0.15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn-primary {
  background: var(--accent); color: #fff; font-weight: 700;
  box-shadow: 0 2px 6px rgba(224, 9, 95, 0.25);
}
.btn-primary:hover {
  background: var(--accent-deep);
  box-shadow: 0 8px 22px rgba(224, 9, 95, 0.32), 0 2px 6px rgba(224, 9, 95, 0.2);
}
.btn-alt {
  background: var(--bg); color: var(--ink);
  border: 1.5px solid var(--border-strong);
}
.btn-alt:hover {
  border-color: var(--accent); color: var(--accent);
  box-shadow: 0 6px 16px rgba(36, 33, 49, 0.08);
}
.btn-sm { padding: 11px 22px; font-size: 15px; }
.btn-pill { border-radius: 999px; }

/* ── Hero ────────────────────────────────────────────────────── */
.hero-split {
  position: relative;
  max-width: var(--max);
  margin: 0 auto;
  padding: 88px var(--pad) 64px;
  display: grid; grid-template-columns: 1.08fr 0.92fr; align-items: center; gap: 32px;
}
.hero-edge {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0;
}
.edge-path {
  stroke: var(--accent); stroke-width: 2.5; opacity: 0.4;
  stroke-dasharray: 8 9; stroke-linecap: round;
  animation: dashflow 1.1s linear infinite;
}
.edge-node circle { fill: #fff; stroke: var(--accent); stroke-width: 2.5; opacity: 0.85; }
.edge-node .core { fill: var(--accent); stroke: none; }
.hero-text { position: relative; z-index: 1; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0 0 22px;
  padding: 7px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg);
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em;
  color: var(--dim);
  animation: rise 0.55s ease both;
}
.eyebrow-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.hero-split h1 {
  margin: 0 0 14px;
  font-size: clamp(42px, 5.4vw, 74px);
  font-weight: 800; line-height: 1.02;
  letter-spacing: -0.028em;
  animation: rise 0.55s 0.06s ease both;
}
.hero-split .name {
  font-size: 0.52em; font-weight: 700;
  display: inline-block; margin-bottom: 8px;
  color: var(--dim); letter-spacing: -0.01em;
}
.hero-split .strap { color: var(--ink); }
.hero-split .strap em {
  font-style: normal;
  color: var(--accent);
  position: relative; white-space: nowrap;
}
/* marker stroke beneath “superpowers” */
.hero-split .strap em::after {
  content: "";
  position: absolute; left: 2%; right: 2%; bottom: 0.02em; height: 0.16em;
  background: var(--accent);
  opacity: 0.18; border-radius: 99px;
}
.hero-split p.lead {
  margin: 0 0 34px;
  font-size: clamp(18px, 2vw, 23px);
  color: var(--dim);
  animation: rise 0.55s 0.12s ease both;
}
.hero-split .ctas {
  display: flex; gap: 12px; flex-wrap: wrap;
  animation: rise 0.55s 0.18s ease both;
}
.hero-art {
  position: relative; z-index: 1;
  display: flex; justify-content: center;
  animation: rise 0.6s 0.1s ease both;
}
.hero-art img {
  width: min(330px, 72%); height: auto;
  filter: drop-shadow(0 30px 60px rgba(224, 9, 95, 0.3));
  animation: bob 7s ease-in-out infinite;
}

/* ── Diagram kinds band (full-bleed, bordered — a real section) ── */
section.kinds {
  margin: 26px 0 34px;
  padding: 34px var(--pad) 38px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.kinds-head {
  margin: 0 0 22px;
  text-align: center;
  font-size: 15px;
  color: var(--dim);
}
.kinds-head strong { color: var(--ink); }
.kinds-marquee {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}
.kinds-marquee + .kinds-marquee { margin-top: 14px; }
/* continuous marquee: each row blends two thirds of the catalogue (A+B / B+C / C+A) */
.kinds-track {
  display: flex;
  width: max-content;
  animation: kinds-scroll 56s linear infinite;
}
.kinds-marquee.reverse .kinds-track { animation-direction: reverse; animation-duration: 64s; }
.kinds-marquee:nth-of-type(3) .kinds-track { animation-duration: 60s; }
.kinds-marquee:hover .kinds-track { animation-play-state: paused; }
@keyframes kinds-scroll { to { transform: translateX(-50%); } }
.kinds-track .kind { margin-right: 14px; }
@media (prefers-reduced-motion: reduce) {
  .kinds-track { animation: none; width: auto; flex-wrap: wrap; justify-content: center; row-gap: 12px; padding: 0 var(--pad); margin: 0 auto; max-width: var(--max); }
  .kinds-track .kind[aria-hidden="true"] { display: none; }
}
.kind {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 10px 20px 10px 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg);
  font-family: var(--display);
  font-size: 16.5px; font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
  transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.2s ease;
}
.kind:hover {
  text-decoration: none;
  border-color: var(--accent); color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(36, 33, 49, 0.08);
}
.kind svg { width: 19px; height: 19px; color: var(--dim); flex: none; transition: color 0.15s ease; }
.kind:hover svg { color: var(--accent); }

/* ── MCP (connect any AI) ────────────────────────────────────── */
section.mcp {
  max-width: var(--max);
  margin: 0 auto;
  padding: 10px var(--pad) 34px;
  scroll-margin-top: 96px; /* clear the sticky nav when arriving via #mcp */
}
/* same node language as the feature cards: crisp border + port dot */
.mcp-inner {
  position: relative;
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 44px;
  align-items: center;
  background: var(--bg);
  border: 1.5px solid var(--border-strong);
  border-radius: 22px;
  padding: 42px 46px;
  box-shadow: 0 1px 2px rgba(36, 33, 49, 0.04);
}
.mcp-inner::before {
  content: "";
  position: absolute; top: -7px; left: 38px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--accent);
}
.mcp-inner::after {
  content: "";
  position: absolute; top: -2.5px; left: 42.5px;
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--accent);
}
.mcp-copy h2 {
  margin: 0 0 14px;
  font-size: clamp(24px, 2.6vw, 32px); font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--ink);
}
.mcp-copy > p { margin: 0 0 16px; font-size: 15.5px; color: var(--dim); }
.mcp-copy > p code { font-size: 14px; color: var(--ink); }
.mcp-steps {
  margin: 0 0 18px; padding-left: 22px;
  display: flex; flex-direction: column; gap: 6px;
  font-size: 14.5px; color: var(--dim);
}
.mcp-steps li::marker { color: var(--accent); font-weight: 700; }
.mcp-tools {
  list-style: none;
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 0; padding: 0;
}
.mcp-tools code {
  display: inline-block;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12.5px;
  color: var(--ink);
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.mcp-tools li:hover code {
  border-color: var(--accent); color: var(--accent);
  transform: translateY(-1px);
}
.mcp-h2-edge { display: block; margin: 0 0 18px; }
.mcp-snippets { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
/* the connect snippet, dressed as a tiny terminal */
.mcp-term {
  background: var(--ink);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(36, 33, 49, 0.18);
}
.mcp-term-bar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 12px 10px 14px;
  background: rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.mcp-term-dots { display: inline-flex; gap: 6px; }
.mcp-term-dots i { width: 10px; height: 10px; border-radius: 50%; }
.mcp-term-dots i:nth-child(1) { background: #ff5f57; }
.mcp-term-dots i:nth-child(2) { background: #febc2e; }
.mcp-term-dots i:nth-child(3) { background: #28c840; }
.mcp-tabs { display: flex; gap: 4px; flex: 1; }
.mcp-tab {
  appearance: none; border: 0; background: transparent;
  font-family: var(--font); font-size: 12.5px; font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  padding: 5px 11px; border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.mcp-tab:hover { color: #fff; }
.mcp-tab.active { background: rgba(255, 255, 255, 0.14); color: #fff; }
.mcp-copy-btn {
  appearance: none; background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.28); border-radius: 8px;
  font-family: var(--font); font-size: 12px; font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  padding: 4px 11px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.mcp-copy-btn:hover { border-color: #fff; color: #fff; }
.mcp-term pre {
  margin: 0;
  padding: 16px 18px 18px;
  min-height: 96px;
  overflow-x: auto;
  font-size: 13px; line-height: 1.6;
  color: #f3f1f8;
}
.mcp-note { margin: 0; font-size: 13px; color: var(--dim); }

/* ── Feature nodes ───────────────────────────────────────────── */
section.features {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px var(--pad) 44px;
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 22px;
}
/* each card is a diagram node: crisp border + a port dot on the top edge */
.feature {
  position: relative;
  background: var(--bg);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 26px 28px 24px;
  box-shadow: 0 1px 2px rgba(36, 33, 49, 0.04);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  animation: rise 0.55s ease both;
}
.feature:nth-child(2) { animation-delay: 0.08s; }
.feature:nth-child(3) { animation-delay: 0.16s; }
.feature::before {
  content: "";
  position: absolute; top: -7px; left: 30px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--accent);
}
.feature::after {
  content: "";
  position: absolute; top: -2.5px; left: 34.5px;
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--accent);
}
.feature:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 16px 36px rgba(224, 9, 95, 0.1), 0 4px 10px rgba(36, 33, 49, 0.06);
}
.feature h3 { margin: 0 0 8px; font-size: 17.5px; font-weight: 700; color: var(--ink); }
.feature p { margin: 0; font-size: 14.5px; color: var(--dim); }

/* ── Hero preview ────────────────────────────────────────────── */
.preview {
  max-width: var(--max);
  margin: 28px auto 96px;
  padding: 0 var(--pad);
}
.preview-frame {
  background: #ffffff;
  border: 1.5px solid var(--border-strong);
  border-radius: 22px;
  padding: 26px;
  box-shadow: 0 36px 90px rgba(224, 9, 95, 0.1), 0 14px 38px rgba(36, 33, 49, 0.1);
  overflow: hidden;
}
.preview-frame img { display: block; width: 100%; height: auto; border-radius: 10px; }

/* ── Samples ─────────────────────────────────────────────────── */
section.samples {
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px var(--pad) 110px;
}
.section-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 38px;
  flex-wrap: wrap; gap: 8px;
}
.section-header h2 {
  margin: 0;
  font-size: clamp(28px, 3.4vw, 40px); font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--ink);
}
.section-header .hint { color: var(--dim); font-size: 14px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 24px;
}
.card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  display: flex; flex-direction: column;
  cursor: pointer;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 18px 44px rgba(36, 33, 49, 0.12), 0 6px 14px rgba(224, 9, 95, 0.08);
}
.card-preview {
  background: var(--bg-soft);
  aspect-ratio: 16 / 9;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.card-preview img { width: 100%; height: 100%; object-fit: contain; padding: 16px; }
.card-body { padding: 20px 24px 22px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.card-title { margin: 0; font-size: 16.5px; font-weight: 700; color: var(--ink); }
.card-desc { margin: 0; color: var(--dim); font-size: 14px; }
.card-meta {
  margin-top: auto; padding-top: 16px;
  display: flex; gap: 14px; align-items: center;
  font-size: 12px; color: var(--dim);
  font-family: var(--mono);
}

/* ── Modal (sample detail) ───────────────────────────────────── */
body.modal-open { overflow: hidden; }
.modal { position: fixed; inset: 0; z-index: 100; }
.modal-overlay {
  position: absolute; inset: 0;
  background: rgba(36, 33, 49, 0.45);
  backdrop-filter: blur(6px);
}
.modal-content {
  position: absolute;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(1240px, 96vw);
  height: min(820px, 92vh);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 40px 100px rgba(36, 33, 49, 0.35);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
.modal-title { margin: 0; font-size: 16px; font-weight: 700; color: var(--ink); }
.modal-actions { display: flex; gap: 14px; align-items: center; }
.modal-gh { font-size: 13px; color: var(--dim); }
.modal-gh:hover { color: var(--accent); text-decoration: none; }
.modal-close {
  background: transparent; border: 1px solid var(--border-strong);
  color: var(--dim); border-radius: 8px;
  width: 32px; height: 32px;
  cursor: pointer; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color 0.14s ease, border-color 0.14s ease;
}
.modal-close:hover { color: var(--accent); border-color: var(--dim); }
.modal-body {
  flex: 1;
  display: grid; grid-template-columns: minmax(320px, 1fr) 1.2fr;
  min-height: 0;
}
.modal-pane-source {
  border-right: 1px solid var(--border);
  background: var(--bg-soft);
  overflow: auto;
}
.modal-pane-source pre {
  margin: 0;
  padding: 20px 22px;
  font-size: 12.5px; line-height: 1.65;
  color: var(--ink);
  white-space: pre;
  tab-size: 2;
}
.modal-pane-preview {
  background: #ffffff;
  overflow: auto;
  padding: 24px;
  display: flex; align-items: center; justify-content: center;
}
.modal-pane-preview img { max-width: 100%; max-height: 100%; }

/* DSL syntax tokens — same palette as the editor's CodeMirror theme */
.tok-comment { color: #3e7e22; font-style: italic; }
.tok-kw { color: #1f48cf; font-weight: 600; }
.tok-str { color: #b03524; }
.tok-op { color: #6e6a7c; font-weight: 600; }

/* ── Footer ──────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 36px var(--pad) 42px;
  text-align: center;
  color: var(--dim);
  font-size: 13px;
  background: var(--bg);
}
footer a { color: var(--dim); }
footer a:hover { color: var(--accent); }
.reg-badges { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 0 0 16px; }
.reg-badges img { display: block; height: 20px; }

/* ── Responsive + reduced motion ─────────────────────────────── */
@media (max-width: 880px) {
  .nav-inner { padding: 12px; }
  .brand { font-size: 18px; gap: 7px; }
  .brand img { width: 30px; height: 30px; }
  .nav-right { gap: 6px; }
  .nav-gh { padding: 7px 9px 7px 11px; font-size: 13px; gap: 6px; white-space: nowrap; }
  .nav-gh svg { width: 16px; height: 16px; }
  .nav-gh-count { font-size: 11.5px; padding: 1px 7px; }
  nav .btn-sm { padding: 8px 12px; font-size: 13px; }
  .hero-split { grid-template-columns: 1fr; text-align: center; padding-top: 56px; gap: 12px; }
  .hero-split .ctas { justify-content: center; }
  .hero-art { order: -1; }
  .hero-art img { width: 150px; }
  .hero-edge { display: none; }
  .mcp-inner { grid-template-columns: 1fr; gap: 28px; padding: 30px 26px; }
  .mcp-term-bar { flex-wrap: wrap; row-gap: 8px; }
  .mcp-tabs { order: 3; flex-basis: 100%; }
  .mcp-copy-btn { margin-left: auto; }
  .modal-content { width: 96vw; height: 94vh; }
  .modal-body { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .modal-pane-source { border-right: none; border-bottom: 1px solid var(--border); }
}
@media (prefers-reduced-motion: reduce) {
  .eyebrow, .hero-split h1, .hero-split p.lead, .hero-split .ctas, .hero-art, .feature { animation: none; }
  .hero-art img { animation: none; }
  .edge-path { animation: none; }
  html { scroll-behavior: auto; }
}
