/* ============================================================
   Semantic Diffing for Evolving Knowledge Graphs — frontend
   Palette is pulled directly from graph_utils.py's own diff
   visualisation, so the marketing page and the real graph
   render share one visual language.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root{
  --bg:        #0b0d12;
  --bg-raised: #12151d;
  --bg-card:   #131722;
  --bg-inset:  #07080c;

  --text:      #e8e6e0;
  --text-dim:  #98a0ad;
  --text-faint:#5a6171;

  --add:        #1d9e75;
  --add-bright: #2fc794;
  --add-soft:   rgba(29,158,117,0.13);

  --rem:        #d85a30;
  --rem-bright: #f07a4d;
  --rem-soft:   rgba(216,90,48,0.13);

  --neu:  #5a7fa8;
  --edge: #3c4554;

  --border:        rgba(232,230,224,0.09);
  --border-strong: rgba(232,230,224,0.18);

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 18px;

  --mono:    'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
  --display: 'Space Grotesk', var(--mono), sans-serif;
  --body:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --maxw: 1180px;
}

*,*::before,*::after{ box-sizing:border-box; }
html{ scroll-behavior:smooth; }
@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior:auto; }
  *,*::before,*::after{ animation-duration:0.01ms !important; animation-iteration-count:1 !important; transition-duration:0.01ms !important; scroll-behavior:auto !important; }
}

body{
  margin:0;
  background:
    radial-gradient(circle at 1px 1px, rgba(232,230,224,0.05) 1px, transparent 1.6px) 0 0/26px 26px,
    var(--bg);
  color:var(--text);
  font-family:var(--body);
  font-size:16px;
  line-height:1.6;
  -webkit-font-smoothing:antialiased;
}

a{ color:inherit; }
::selection{ background:var(--add); color:#06140f; }

:focus-visible{
  outline:2px solid var(--add-bright);
  outline-offset:3px;
  border-radius:4px;
}

.wrap{
  max-width:var(--maxw);
  margin:0 auto;
  padding:0 28px;
}

h1,h2,h3,h4{
  font-family:var(--display);
  font-weight:600;
  margin:0;
  letter-spacing:-0.01em;
}

p{ margin:0; }

.eyebrow{
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-family:var(--mono);
  font-size:12.5px;
  letter-spacing:0.04em;
  color:var(--add-bright);
  text-transform:lowercase;
  margin-bottom:14px;
}
.eyebrow::before{ content:"//"; color:var(--text-faint); }

.section{
  padding:108px 0;
  border-bottom:1px solid var(--border);
}
.section-head{
  max-width:640px;
  margin-bottom:52px;
}
.section-head h2{
  font-size:clamp(26px,3.4vw,38px);
  margin-bottom:14px;
}
.section-head p{
  color:var(--text-dim);
  font-size:16.5px;
  max-width:580px;
}

/* ---------- reveal-on-scroll ---------- */
[data-reveal]{
  opacity:0;
  transform:translateY(18px);
  transition:opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1);
}
[data-reveal].in-view{ opacity:1; transform:translateY(0); }

/* ---------- nav ---------- */
.nav{
  position:fixed; top:0; left:0; right:0; z-index:100;
  border-bottom:1px solid transparent;
  transition:border-color .3s ease, background .3s ease;
}
.nav.scrolled{
  background:rgba(11,13,18,0.82);
  backdrop-filter:blur(10px);
  border-bottom-color:var(--border);
}
.nav-inner{
  display:flex; align-items:center; justify-content:space-between;
  padding:18px 28px;
  max-width:var(--maxw); margin:0 auto;
}
.logo{
  display:flex; align-items:center; gap:9px;
  font-family:var(--mono); font-weight:600; font-size:15px;
  text-decoration:none; color:var(--text);
}
.logo .glyph{
  display:inline-flex; align-items:center; justify-content:center;
  width:24px; height:24px; border-radius:6px;
  background:var(--add-soft); color:var(--add-bright);
  font-size:13px; font-weight:700;
  border:1px solid rgba(29,158,117,0.35);
}
.nav-links{
  display:flex; gap:30px; list-style:none; margin:0; padding:0;
  font-family:var(--mono); font-size:13.5px; color:var(--text-dim);
}
.nav-links a{ text-decoration:none; transition:color .2s; }
.nav-links a:hover{ color:var(--text); }
.nav-cta{ display:flex; align-items:center; gap:14px; }
.nav-toggle{
  display:none; background:none; border:1px solid var(--border-strong);
  border-radius:7px; width:38px; height:34px; color:var(--text);
  cursor:pointer; font-family:var(--mono);
}

.btn{
  display:inline-flex; align-items:center; gap:8px;
  font-family:var(--mono); font-size:13.5px; font-weight:500;
  padding:10px 18px; border-radius:8px;
  text-decoration:none; cursor:pointer; border:1px solid transparent;
  transition:transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
  white-space:nowrap;
}
.btn:active{ transform:translateY(1px); }
.btn-primary{
  background:var(--add); color:#06140f;
  box-shadow:0 0 0 0 rgba(29,158,117,0.0);
}
.btn-primary:hover{ background:var(--add-bright); box-shadow:0 6px 24px -8px rgba(47,199,148,0.55); }
.btn-ghost{
  background:transparent; color:var(--text); border-color:var(--border-strong);
}
.btn-ghost:hover{ border-color:var(--text-dim); }
.btn-sm{ padding:7px 13px; font-size:12.5px; }
.btn[disabled]{ opacity:.5; cursor:not-allowed; transform:none !important; }

/* ---------- hero ---------- */
.hero{
  padding:172px 0 96px;
  position:relative;
  overflow:hidden;
}
.hero-grid{
  display:grid; grid-template-columns:1.05fr 0.95fr; gap:56px; align-items:center;
}
.hero h1{
  font-size:clamp(36px,5vw,58px);
  line-height:1.04;
}
.hero h1 .accent{ color:var(--add-bright); }
.hero h1 .strike{
  color:var(--rem);
  text-decoration:line-through;
  text-decoration-thickness:2px;
  text-decoration-color:rgba(216,90,48,0.6);
}
.hero-sub{
  margin-top:22px; font-size:17.5px; color:var(--text-dim); max-width:480px;
}
.hero-cta{ display:flex; gap:14px; margin-top:34px; flex-wrap:wrap; }
.hero-meta{
  margin-top:40px; display:flex; gap:26px; flex-wrap:wrap;
  font-family:var(--mono); font-size:12.5px; color:var(--text-faint);
}
.hero-meta span b{ color:var(--text-dim); font-weight:500; }

.hero-visual{
  background:var(--bg-inset);
  border:1px solid var(--border);
  border-radius:var(--r-lg);
  overflow:hidden;
  box-shadow:0 30px 80px -30px rgba(0,0,0,.6);
}
.hero-visual-bar{
  display:flex; align-items:center; justify-content:space-between;
  padding:11px 16px; border-bottom:1px solid var(--border);
  font-family:var(--mono); font-size:11.5px; color:var(--text-faint);
}
.dot-trio{ display:flex; gap:6px; }
.dot-trio span{ width:8px; height:8px; border-radius:50%; background:var(--edge); }

/* ---------- diff console ---------- */
.console{
  background:var(--bg-inset);
  border:1px solid var(--border);
  border-radius:var(--r-md);
  overflow:hidden;
}
.console-bar{
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 16px; border-bottom:1px solid var(--border);
  font-family:var(--mono); font-size:11.5px; color:var(--text-faint);
}
.console-body{
  font-family:var(--mono); font-size:13px; line-height:1.85;
  padding:16px 18px; min-height:120px;
}
.console-line{
  display:flex; gap:10px;
  opacity:0; transform:translateY(4px);
  animation:lineIn .45s ease forwards;
}
@keyframes lineIn{ to{ opacity:1; transform:translateY(0); } }
.console-line .tag{ width:14px; flex:0 0 auto; font-weight:700; }
.console-line.add .tag, .console-line.add .body{ color:var(--add-bright); }
.console-line.rem .tag, .console-line.rem .body{ color:var(--rem-bright); }
.console-line.info .tag, .console-line.info .body{ color:var(--text-faint); }
.console-line .body{ color:var(--text-dim); white-space:pre; }
.cursor{
  display:inline-block; width:7px; height:14px; background:var(--add-bright);
  animation:blink 1s steps(1) infinite; vertical-align:-2px;
}
@keyframes blink{ 50%{ opacity:0; } }

/* ---------- sentence diff (overview) ---------- */
.overview-grid{
  display:grid; grid-template-columns:1fr 1fr; gap:60px; align-items:start;
}
.overview-copy p{ color:var(--text-dim); font-size:16px; }
.overview-copy p + p{ margin-top:16px; }
.feature-list{
  list-style:none; margin:26px 0 0; padding:0;
  display:grid; gap:10px;
}
.feature-list li{
  display:flex; gap:10px; align-items:flex-start;
  font-size:14.5px; color:var(--text-dim);
}
.feature-list li::before{
  content:"+"; color:var(--add-bright); font-family:var(--mono); font-weight:700;
}
.sentence-card{
  background:var(--bg-card); border:1px solid var(--border); border-radius:var(--r-md);
  padding:24px;
}
.sentence-card .label{
  font-family:var(--mono); font-size:11.5px; color:var(--text-faint);
  text-transform:uppercase; letter-spacing:.05em; margin-bottom:14px; display:block;
}
.sentence-card p{
  font-family:var(--mono); font-size:14.5px; line-height:2;
  color:var(--text-dim);
}
.diff-rem{ color:var(--rem-bright); background:var(--rem-soft); text-decoration:line-through; padding:1px 4px; border-radius:3px; }
.diff-add{ color:var(--add-bright); background:var(--add-soft); padding:1px 4px; border-radius:3px; }

/* ---------- pipeline ---------- */
.pipeline{
  display:grid; grid-template-columns:repeat(5,1fr); gap:0; position:relative;
}
.pipe-stage{
  position:relative; padding:0 16px 0 0; text-align:left;
}
.pipe-stage .num{
  font-family:var(--mono); font-size:12px; color:var(--text-faint); margin-bottom:14px; display:block;
}
.pipe-node{
  width:46px; height:46px; border-radius:11px;
  background:var(--bg-card); border:1px solid var(--border-strong);
  display:flex; align-items:center; justify-content:center;
  margin-bottom:16px; transition:border-color .4s ease, box-shadow .4s ease, background .4s ease;
}
.pipe-stage.active .pipe-node{
  border-color:var(--add); background:var(--add-soft);
  box-shadow:0 0 0 4px rgba(29,158,117,0.08);
}
.pipe-node svg{ width:21px; height:21px; stroke:var(--text-dim); transition:stroke .4s ease; }
.pipe-stage.active .pipe-node svg{ stroke:var(--add-bright); }
.pipe-stage h4{ font-size:15px; margin-bottom:6px; }
.pipe-stage p{ font-size:13px; color:var(--text-faint); line-height:1.55; }
.pipe-line{
  position:absolute; top:23px; left:46px; right:-16px; height:1px;
  background:var(--border-strong); overflow:hidden;
}
.pipe-line::after{
  content:""; position:absolute; inset:0; background:var(--add);
  transform:scaleX(0); transform-origin:left; transition:transform .6s ease;
}
.pipe-stage.active .pipe-line::after{ transform:scaleX(1); }
.pipe-stage:last-child .pipe-line{ display:none; }

/* ---------- live demo ---------- */
.demo-shell{
  background:var(--bg-raised); border:1px solid var(--border); border-radius:var(--r-lg);
  padding:34px; margin-top:8px;
}
.demo-toprow{
  display:flex; justify-content:space-between; align-items:center; gap:20px; flex-wrap:wrap;
  margin-bottom:24px;
}
.demo-toprow .status{
  font-family:var(--mono); font-size:12.5px; color:var(--text-faint);
  display:flex; align-items:center; gap:8px;
}
.status-dot{ width:7px; height:7px; border-radius:50%; background:var(--neu); }
.status-dot.live{ background:var(--add-bright); box-shadow:0 0 0 3px rgba(47,199,148,0.18); }

.doc-grid{
  display:grid; grid-template-columns:1fr 1fr; gap:18px;
}
.doc-panel{
  background:var(--bg-card); border:1px solid var(--border); border-radius:var(--r-md);
  overflow:hidden;
}
.doc-panel .doc-head{
  display:flex; justify-content:space-between; align-items:center;
  padding:10px 14px; border-bottom:1px solid var(--border);
  font-family:var(--mono); font-size:11.5px;
}
.doc-panel.v1 .doc-head{ color:var(--neu); }
.doc-panel.v2 .doc-head{ color:var(--add-bright); }
.doc-panel textarea{
  width:100%; min-height:172px; resize:vertical;
  background:transparent; border:0; outline:0;
  color:var(--text-dim); font-family:var(--body); font-size:13.8px; line-height:1.65;
  padding:14px; margin:0;
}

.adv-toggle{
  margin-top:16px; font-family:var(--mono); font-size:12.5px; color:var(--text-faint);
  cursor:pointer; user-select:none;
}
.adv-toggle:hover{ color:var(--text-dim); }
.adv-panel{
  margin-top:14px; padding:16px; border:1px dashed var(--border-strong); border-radius:var(--r-md);
  display:none; gap:12px;
}
.adv-panel.open{ display:grid; }
.adv-panel label{ font-family:var(--mono); font-size:11.5px; color:var(--text-faint); display:block; margin-bottom:6px; }
.adv-panel input[type=text]{
  width:100%; background:var(--bg-inset); border:1px solid var(--border-strong); border-radius:7px;
  padding:9px 12px; color:var(--text); font-family:var(--mono); font-size:13px;
}
.adv-panel .note{ font-size:12.5px; color:var(--text-faint); line-height:1.6; }

.demo-actions{ display:flex; gap:12px; margin-top:22px; flex-wrap:wrap; align-items:center; }
.demo-note{ font-family:var(--mono); font-size:12px; color:var(--text-faint); }

.demo-results{ margin-top:34px; }
.demo-results.hidden{ display:none; }

.graphs-grid{
  display:grid; grid-template-columns:1fr 1fr; gap:18px; margin-bottom:22px;
}
.graph-pane{
  background:var(--bg-card); border:1px solid var(--border); border-radius:var(--r-md); overflow:hidden;
}
.graph-pane .gp-head{
  display:flex; justify-content:space-between; padding:10px 14px; border-bottom:1px solid var(--border);
  font-family:var(--mono); font-size:11.5px; color:var(--text-faint);
}
.graph-pane svg{ width:100%; height:300px; display:block; }
.graph-node-label{ font-family:var(--mono); font-size:9.5px; fill:var(--text); pointer-events:none; }

.legend{ display:flex; gap:18px; flex-wrap:wrap; padding:14px; border-top:1px solid var(--border); margin-bottom:22px; }
.legend-item{ display:flex; align-items:center; gap:7px; font-family:var(--mono); font-size:11px; color:var(--text-faint); }
.legend-swatch{ width:10px; height:10px; border-radius:3px; }

.stat-grid{
  display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:22px;
}
.stat-card{
  background:var(--bg-card); border:1px solid var(--border); border-radius:var(--r-md);
  padding:18px;
}
.stat-card .n{ font-family:var(--mono); font-size:30px; font-weight:700; }
.stat-card.add .n{ color:var(--add-bright); }
.stat-card.rem .n{ color:var(--rem-bright); }
.stat-card .l{ font-family:var(--mono); font-size:11.5px; color:var(--text-faint); margin-top:4px; }

.summary-panel{
  background:var(--bg-card); border:1px solid var(--border); border-radius:var(--r-md);
  padding:22px 24px; margin-bottom:22px;
}
.summary-panel .eyebrow{ margin-bottom:10px; }
.summary-panel p{ font-size:15.5px; color:var(--text-dim); line-height:1.75; }
.summary-panel .typecursor{ display:inline-block; width:7px; height:15px; background:var(--add-bright); vertical-align:-2px; animation:blink 1s steps(1) infinite; }

details.json-toggle{ border:1px solid var(--border); border-radius:var(--r-md); overflow:hidden; }
details.json-toggle summary{
  cursor:pointer; padding:13px 16px; font-family:var(--mono); font-size:12.5px; color:var(--text-dim);
  list-style:none; display:flex; align-items:center; gap:8px;
}
details.json-toggle summary::-webkit-details-marker{ display:none; }
details.json-toggle summary::before{ content:"›"; transition:transform .2s ease; display:inline-block; color:var(--text-faint); }
details.json-toggle[open] summary::before{ transform:rotate(90deg); }
.code-block{
  margin:0; padding:18px; background:var(--bg-inset); border-top:1px solid var(--border);
  font-family:var(--mono); font-size:12.5px; color:var(--text-dim); line-height:1.7;
  overflow-x:auto; max-height:340px;
}
.code-block .k{ color:var(--neu); }
.code-block .s-add{ color:var(--add-bright); }
.code-block .s-rem{ color:var(--rem-bright); }

/* ---------- architecture / stack ---------- */
.stack-badges{ display:flex; flex-wrap:wrap; gap:10px; }
.badge{
  font-family:var(--mono); font-size:12.5px; color:var(--text-dim);
  border:1px solid var(--border-strong); border-radius:999px; padding:8px 16px;
  display:inline-flex; align-items:center; gap:8px;
}
.badge .dot{ width:6px; height:6px; border-radius:50%; background:var(--neu); }

.arch-grid{ display:grid; grid-template-columns:1fr 1fr; gap:56px; align-items:start; margin-top:48px; }
.arch-list{ list-style:none; margin:0; padding:0; display:grid; gap:18px; }
.arch-list li{ border-left:2px solid var(--border-strong); padding-left:16px; }
.arch-list code{ font-family:var(--mono); font-size:13.5px; color:var(--add-bright); }
.arch-list p{ color:var(--text-faint); font-size:13.5px; margin-top:4px; }

/* ---------- use cases ---------- */
.usecase-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:16px; }
.usecase-card{
  background:var(--bg-card); border:1px solid var(--border); border-radius:var(--r-md);
  padding:22px; transition:border-color .25s ease, transform .25s ease;
}
.usecase-card:hover{ border-color:var(--border-strong); transform:translateY(-3px); }
.usecase-card h4{ font-size:15.5px; margin-bottom:8px; }
.usecase-card p{ font-size:13.5px; color:var(--text-faint); line-height:1.6; }

/* ---------- roadmap ---------- */
.roadmap-wrap{ display:flex; flex-wrap:wrap; gap:10px; }
.chip{
  font-family:var(--mono); font-size:12.5px; color:var(--text-dim);
  border:1px dashed var(--border-strong); border-radius:999px; padding:9px 16px;
}

/* ---------- limitations strip ---------- */
.limits-grid{ display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-top:36px; }
.limit-item{ font-family:var(--mono); font-size:12.5px; color:var(--text-faint); border-top:1px solid var(--border-strong); padding-top:12px; }

/* ---------- footer ---------- */
footer{ padding:48px 0 60px; }
.footer-inner{ display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:16px; }
.footer-inner .left{ font-family:var(--mono); font-size:12.5px; color:var(--text-faint); }
.footer-links{ display:flex; gap:22px; font-family:var(--mono); font-size:12.5px; }
.footer-links a{ color:var(--text-dim); text-decoration:none; }
.footer-links a:hover{ color:var(--text); }

/* ---------- responsive ---------- */
@media (max-width: 980px){
  .hero-grid{ grid-template-columns:1fr; }
  .hero{ padding-top:140px; }
  .overview-grid{ grid-template-columns:1fr; gap:36px; }
  .pipeline{ grid-template-columns:1fr; gap:28px; }
  .pipe-line{ display:none; }
  .arch-grid{ grid-template-columns:1fr; gap:32px; }
  .usecase-grid{ grid-template-columns:1fr 1fr; }
  .stat-grid{ grid-template-columns:1fr 1fr; }
  .limits-grid{ grid-template-columns:1fr 1fr; }
}
@media (max-width: 760px){
  .nav-links, .nav-cta .btn-ghost{ display:none; }
  .nav-toggle{ display:block; }
  .doc-grid, .graphs-grid{ grid-template-columns:1fr; }
  .usecase-grid{ grid-template-columns:1fr; }
  .section{ padding:76px 0; }
  .demo-shell{ padding:22px; }
}
