@import url('./notebook-shared.css');

/* ── Reset & base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: #0f1117;
  color: #e2e8f0;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: #818cf8; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Hero ──────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 50%, #1e293b 100%);
  border-bottom: 1px solid #312e81;
  padding: 4rem 2rem 3rem;
  text-align: center;
}
.hero-inner { max-width: 720px; margin: 0 auto; }

.hero-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #a5b4fc;
  background: rgba(99,102,241,.15);
  border: 1px solid rgba(99,102,241,.35);
  border-radius: 999px;
  padding: 0.25rem 0.85rem;
  margin-bottom: 1.25rem;
}

.hero h1 {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 700;
  background: linear-gradient(135deg, #c7d2fe 0%, #818cf8 50%, #6366f1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
  margin-bottom: 0.85rem;
}

.hero-sub {
  font-size: 1.05rem;
  color: #94a3b8;
  margin-bottom: 1.5rem;
}
.hero-sub strong { color: #c7d2fe; font-weight: 500; }

.hero-pills { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
.pill {
  font-size: 0.75rem;
  font-weight: 500;
  color: #6366f1;
  background: rgba(99,102,241,.12);
  border: 1px solid rgba(99,102,241,.3);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
}

/* ── Layout ─────────────────────────────────────────────── */
.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* ── Card ───────────────────────────────────────────────── */
.card {
  background: #1e2130;
  border: 1px solid #2d3148;
  border-radius: 1rem;
  padding: 1.75rem 2rem;
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.card-icon {
  font-size: 1.5rem;
  line-height: 1;
  margin-top: 0.2rem;
  flex-shrink: 0;
}
.card-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 0.2rem;
}
.card-desc { font-size: 0.88rem; color: #64748b; }

/* ── Demo grid ──────────────────────────────────────────── */
.demo-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 680px) { .demo-grid { grid-template-columns: 1fr; } }

/* Controls */
.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

input[type=range] {
  flex: 1;
  -webkit-appearance: none;
  height: 4px;
  border-radius: 4px;
  background: #2d3148;
  outline: none;
  cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #6366f1;
  cursor: pointer;
  border: 2px solid #312e81;
  box-shadow: 0 0 0 3px rgba(99,102,241,.25);
}

.n-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.4rem;
  background: #312e81;
  color: #a5b4fc;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  font-weight: 600;
  flex-shrink: 0;
}

/* Buttons */
.btn-group { display: flex; flex-direction: column; gap: 0.6rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 0.6rem;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(.97); }

.btn-secondary {
  background: #2d3148;
  color: #c7d2fe;
  border: 1px solid #3d4170;
}
.btn-secondary:hover { background: #3d4170; }

.btn-primary {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  box-shadow: 0 2px 12px rgba(99,102,241,.35);
}
.btn-primary:hover { opacity: .9; }

/* Result */
.result-panel {
  background: #151824;
  border: 1px solid #2d3148;
  border-radius: 0.75rem;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.82rem;
}
.result-label { color: #64748b; flex-shrink: 0; }
.result-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: #a5b4fc;
  text-align: right;
  word-break: break-all;
}
.result-row.highlight .result-label { color: #94a3b8; font-weight: 500; }
.result-row.highlight .result-value { color: #34d399; font-size: 0.9rem; }

.source-badge {
  font-size: 0.72rem;
  padding: 0.25rem 0.6rem;
  border-radius: 0.4rem;
  text-align: center;
  font-weight: 500;
}
.source-badge.browser {
  color: #fbbf24;
  background: rgba(251,191,36,.1);
  border: 1px solid rgba(251,191,36,.25);
}
.source-badge.api {
  color: #34d399;
  background: rgba(52,211,153,.1);
  border: 1px solid rgba(52,211,153,.25);
}

.error-panel {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  background: rgba(239,68,68,.08);
  border: 1px solid rgba(239,68,68,.25);
  border-radius: 0.65rem;
  padding: 0.75rem 0.9rem;
  font-size: 0.82rem;
  color: #fca5a5;
}
.error-panel svg { flex-shrink: 0; margin-top: 2px; }
.error-panel code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  background: rgba(255,255,255,.07);
  padding: 0.1em 0.4em;
  border-radius: 0.25rem;
}

.hidden { display: none !important; }

/* Graph canvas */
.graph-panel {
  background: #151824;
  border: 1px solid #2d3148;
  border-radius: 0.75rem;
  overflow: hidden;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
#graph-svg { display: block; }
.graph-hint {
  font-size: 0.82rem;
  color: #475569;
  padding: 1rem;
  text-align: center;
}
.graph-hint em { color: #6366f1; font-style: normal; }

/* ── Notebook grid ──────────────────────────────────────── */
.notebook-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.nb-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: #151824;
  border: 1px solid #2d3148;
  border-radius: 0.75rem;
  padding: 1.25rem 1.4rem;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: border-color .2s, background .2s, transform .15s;
}
.nb-card:hover {
  border-color: #6366f1;
  background: #1a1e2e;
  text-decoration: none;
  transform: translateY(-2px);
}
.nb-card.active {
  border-color: #6366f1;
  background: #1e2240;
  box-shadow: 0 0 0 2px #6366f155;
}
.nb-icon { font-size: 1.8rem; flex-shrink: 0; line-height: 1; margin-top: 0.1rem; }
.nb-body { flex: 1; }
.nb-body h3 { font-size: 0.95rem; font-weight: 600; color: #c7d2fe; margin-bottom: 0.3rem; }
.nb-body p  { font-size: 0.80rem; color: #64748b; line-height: 1.55; margin-bottom: 0.5rem; }
.nb-arrow { color: #6366f1; font-size: 1rem; flex-shrink: 0; margin-top: 0.25rem; }

/* notebook tags */
.nb-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.4rem; }
.nb-tag  {
  font-size: 0.68rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #1e2d4a;
  color: #93c5fd;
  border: 1px solid #3b5a8a;
  white-space: nowrap;
}

/* Embedded notebook iframe viewer */
.nb-viewer-container {
  margin-top: 1.25rem;
  border: 1px solid #2d3148;
  border-radius: 0.75rem;
  overflow: hidden;
}
.nb-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  background: #0f1117;
  border-bottom: 1px solid #2d3148;
}
.nb-viewer-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #c7d2fe;
}
.nb-viewer-actions { display: flex; gap: 0.5rem; }
.btn-sm {
  font-size: 0.78rem;
  padding: 0.3rem 0.75rem;
}
.nb-iframe {
  width: 100%;
  height: 78vh;
  border: none;
  background: #fff;
  display: block;
}

/* ── Research summary ───────────────────────────────────── */
.summary-cols {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
}
.summary-cols h4 {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #818cf8;
  margin-bottom: 0.6rem;
}
.summary-cols p, .summary-list {
  font-size: 0.88rem;
  color: #94a3b8;
  line-height: 1.65;
}
.summary-list { padding-left: 1.2rem; }
.summary-list li { margin-bottom: 0.3rem; }

.code-block {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem;
  color: #a5b4fc;
  background: #0f1117;
  border: 1px solid #2d3148;
  border-radius: 0.5rem;
  padding: 0.85rem 1rem;
  white-space: pre;
  overflow-x: auto;
  line-height: 1.7;
}

/* ── Footer ─────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: 0.8rem;
  color: #475569;
  border-top: 1px solid #1e2130;
}
.footer a { color: #6366f1; }
