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

:root {
  --bg-dark: #0f1419;
  --bg-hero: #141b22;
  --bg-light: #f8f9fa;
  --bg-card: #ffffff;
  --text-primary: #1a1a2e;
  --text-secondary: #4a5568;
  --text-light: #e2e8f0;
  --text-muted: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --border: #e2e8f0;
  --code-bg: #1e293b;
  --code-text: #e2e8f0;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --max-width: 1100px;
}

body {
  font-family: var(--font-sans);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* Hero */
.hero {
  background: var(--bg-hero);
  color: var(--text-light);
  padding: 5rem 2rem 4rem;
  text-align: center;
}

.hero h1 {
  font-size: 3.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.hero .tagline {
  font-size: 1.25rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 2rem;
}

.install-cmd {
  display: inline-block;
  background: var(--code-bg);
  color: var(--code-text);
  font-family: var(--font-mono);
  font-size: 1rem;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  margin-bottom: 2rem;
  border: 1px solid #334155;
}

.install-cmd .prompt { color: var(--text-muted); }

.hero-links {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-links a {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s;
}

.hero-links a:hover { color: #fff; }

/* Experimental banner */
.experimental-banner {
  background: #fef3c7;
  border-bottom: 1px solid #f59e0b;
  color: #92400e;
  font-size: 0.9rem;
  padding: 0.75rem 2rem;
  text-align: center;
  line-height: 1.5;
}

.experimental-banner strong {
  color: #78350f;
}

/* Sections */
section {
  padding: 4rem 2rem;
}

section:nth-child(even) { background: var(--bg-light); }
section:nth-child(odd) { background: var(--bg-card); }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
}

h2 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 2rem;
  text-align: center;
  letter-spacing: -0.01em;
}

/* Feature grid */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.feature {
  padding: 1.25rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.feature h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.feature p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Algorithm cards */
.algorithms {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.algo-card {
  padding: 1.25rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.algo-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  font-family: var(--font-mono);
  color: var(--accent);
}

.algo-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Code examples */
.code-example {
  margin-bottom: 2rem;
}

.code-example h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

pre {
  background: var(--code-bg);
  color: var(--code-text);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 1.25rem 1.5rem;
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.6;
}

code {
  font-family: var(--font-mono);
}

p code {
  background: #edf2f7;
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

/* Install section */
.install-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.install-option h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.install-option {
  position: relative;
}

.install-option pre {
  font-size: 0.8rem;
  padding: 0.75rem 1rem;
}

.install-option .copy-btn {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text-muted);
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.install-option .copy-btn:hover {
  background: rgba(255,255,255,0.18);
  color: var(--text-light);
}

.install-option .copy-btn.copied {
  color: #4ade80;
  border-color: rgba(74,222,128,0.4);
}

.install-option .copy-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Footer */
footer {
  background: var(--bg-dark);
  color: var(--text-muted);
  padding: 2rem;
  text-align: center;
  font-size: 0.85rem;
}

footer a { color: var(--text-muted); }
footer a:hover { color: #fff; }

.footer-links {
  display: flex;
  gap: 2rem;
  justify-content: center;
  margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 640px) {
  .hero { padding: 3rem 1.5rem 2.5rem; }
  .hero h1 { font-size: 2.5rem; }
  .hero .tagline { font-size: 1.05rem; }
  section { padding: 3rem 1.5rem; }
  .features, .algorithms { grid-template-columns: 1fr; }
  .why-grid { grid-template-columns: 1fr; }
}

/* Navigation */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-dark);
  border-bottom: 1px solid #1e293b;
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 3.25rem;
}

.nav-logo {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff !important;
  letter-spacing: -0.01em;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active { color: #fff; }

.nav-links a.active {
  border-bottom: 2px solid var(--accent);
  padding-bottom: 2px;
}

.nav-external::after {
  content: "\2197";
  font-size: 0.7em;
  margin-left: 2px;
  opacity: 0.6;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-direction: column;
  gap: 5px;
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-muted);
  transition: transform 0.2s, opacity 0.2s;
}

.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Page header (sub-pages) */
.page-header {
  background: var(--bg-hero);
  color: var(--text-light);
  padding: 3rem 2rem 2.5rem;
  text-align: center;
}

.page-header h1 {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.page-header p {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

th, td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  background: var(--bg-light);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
}

td code {
  background: #edf2f7;
  padding: 0.1em 0.35em;
  border-radius: 3px;
  font-size: 0.85em;
}

/* Table of contents */
.toc {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
}

.toc p {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.toc ul {
  list-style: none;
  padding: 0;
  columns: 2;
  column-gap: 2rem;
}

.toc li {
  font-size: 0.9rem;
  padding: 0.2rem 0;
}

.toc a { color: var(--text-secondary); }
.toc a:hover { color: var(--accent); }

/* Skills / tools grid */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.skill-card {
  padding: 1rem 1.25rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.skill-card h4 {
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.skill-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* Tool cards (MCP page) */
.tool-card {
  padding: 1.25rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  margin-bottom: 1rem;
}

.tool-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.tool-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* CTA links */
.cta {
  display: inline-block;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.95rem;
  margin-top: 1rem;
}

.cta:hover { color: var(--accent-hover); }
.cta::after { content: " \2192"; }

/* Why Tenax / generic card grid */
.why-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.why-card {
  padding: 1.25rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.why-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.why-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Mobile responsive: nav */
@media (max-width: 768px) {
  .nav-toggle { display: flex; }

  .nav-links {
    display: none;
    position: absolute;
    top: 3.25rem;
    left: 0;
    right: 0;
    background: var(--bg-dark);
    flex-direction: column;
    padding: 1rem 2rem;
    gap: 0.75rem;
    border-bottom: 1px solid #1e293b;
  }

  .nav-links.open { display: flex; }
  .nav-links a { font-size: 1rem; }

  .toc ul { columns: 1; }

  .page-header { padding: 2rem 1.5rem 1.5rem; }
  .page-header h1 { font-size: 1.75rem; }
}

/* Syntax highlighting (basic) */
.highlight .k, .highlight .kn, .highlight .kd { color: #c792ea; }
.highlight .s, .highlight .s1, .highlight .s2 { color: #c3e88d; }
.highlight .n { color: #e2e8f0; }
.highlight .nf, .highlight .nb { color: #82aaff; }
.highlight .nn { color: #ffcb6b; }
.highlight .mi, .highlight .mf { color: #f78c6c; }
.highlight .c, .highlight .c1, .highlight .cm { color: #546e7a; }
.highlight .o, .highlight .p { color: #89ddff; }
.highlight .bp { color: #f07178; }
