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

:root {
  --black: #0a0a0a;
  --white: #ffffff;
  --gray-50: #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #e5e5e5;
  --gray-300: #d4d4d4;
  --gray-400: #a3a3a3;
  --gray-500: #737373;
  --gray-600: #525252;
  --gray-700: #404040;
  --gray-800: #262626;
  --gray-900: #171717;
  --green: #22c55e;
  --red: #ef4444;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  --font-display: 'Inter', sans-serif;
  --max-width: 1200px;
  --header-height: 64px;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  color: var(--black);
  background: var(--white);
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

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

img {
  max-width: 100%;
}

/* === Header === */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  z-index: 100;
  display: flex;
  align-items: center;
}

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

.header-logo {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.header-nav a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-600);
  transition: color 0.2s;
}

.header-nav a:hover {
  color: var(--black);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  text-decoration: none;
}

.btn-outline {
  border-color: var(--gray-300);
  background: var(--white);
  color: var(--black);
}

.btn-outline:hover {
  border-color: var(--black);
  background: var(--gray-50);
}

.btn-primary {
  background: var(--black);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--gray-800);
}

.btn-large {
  padding: 0.75rem 2rem;
  font-size: 1rem;
}

/* === Mobile Nav === */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.mobile-menu-btn svg {
  width: 24px;
  height: 24px;
}

@media (max-width: 768px) {
  .header-nav {
    display: none;
  }
  .mobile-menu-btn {
    display: block;
  }
  .header-nav.active {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 2rem;
    gap: 1rem;
  }
}

/* === Hero === */
.hero {
  padding-top: calc(var(--header-height) + 6rem);
  padding-bottom: 6rem;
  max-width: var(--max-width);
  margin: 0 auto;
  padding-left: 2rem;
  padding-right: 2rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 1rem;
  border: 1px solid var(--gray-200);
  border-radius: 100px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--gray-600);
  margin-bottom: 2rem;
}

.hero-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.hero-title {
  font-family: var(--font-mono);
  font-size: clamp(3rem, 8vw, 5.5rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.hero-subtitle {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 400;
  color: var(--gray-500);
  margin-bottom: 2rem;
  letter-spacing: -0.02em;
}

.hero-description {
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--gray-700);
  max-width: 640px;
  margin-bottom: 3rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* === Section Layout === */
.section {
  padding: 5rem 2rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.section-full {
  padding: 5rem 2rem;
}

.section-full-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.section-dark {
  background: var(--gray-900);
  color: var(--white);
}

.section-alt {
  background: var(--gray-50);
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray-400);
  margin-bottom: 1rem;
}

.section-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.section-description {
  font-size: 1.125rem;
  color: var(--gray-600);
  max-width: 600px;
  line-height: 1.7;
  margin-bottom: 3rem;
}

.section-dark .section-description {
  color: var(--gray-400);
}

/* === Code Block === */
.code-block-wrapper {
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  overflow: hidden;
  margin: 2rem 0;
  max-width: 720px;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
}

.code-block-title {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-600);
}

.code-block-copy {
  background: none;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--gray-500);
  transition: all 0.2s;
}

.code-block-copy:hover {
  border-color: var(--black);
  color: var(--black);
}

.code-block {
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  background: var(--white);
}

.code-block pre {
  font-size: 0.8125rem;
  line-height: 1.7;
  color: var(--gray-800);
}

.code-block .comment {
  color: var(--gray-400);
}

.code-block .keyword {
  color: var(--gray-900);
  font-weight: 600;
}

.code-block .string {
  color: var(--gray-600);
}

.code-block .type {
  color: var(--gray-500);
  font-style: italic;
}

/* === Architecture Diagram === */
.architecture {
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 2rem;
  background: var(--gray-50);
  overflow-x: auto;
  margin: 2rem 0;
}

.architecture pre {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--gray-700);
  white-space: pre;
}

/* === Feature Grid === */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.feature-card {
  padding: 2rem;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  transition: border-color 0.2s;
}

.feature-card:hover {
  border-color: var(--gray-400);
}

.feature-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.feature-card h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.feature-card p {
  font-size: 0.9375rem;
  color: var(--gray-600);
  line-height: 1.6;
}

/* === Principles === */
.principles {
  display: grid;
  gap: 0;
  margin: 2rem 0;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  overflow: hidden;
}

.principle {
  display: flex;
  gap: 1.5rem;
  padding: 1.75rem 2rem;
  border-bottom: 1px solid var(--gray-200);
  align-items: flex-start;
}

.principle:last-child {
  border-bottom: none;
}

.principle-number {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--gray-400);
  min-width: 2rem;
  padding-top: 0.1rem;
}

.principle h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
}

.principle p {
  font-size: 0.9375rem;
  color: var(--gray-600);
  line-height: 1.6;
}

/* === Comparison Table === */
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  overflow: hidden;
  margin: 2rem 0;
  font-size: 0.875rem;
}

.comparison-table th {
  text-align: left;
  padding: 1rem 1.25rem;
  background: var(--gray-50);
  font-weight: 600;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

.comparison-table td {
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: top;
}

.comparison-table tr:last-child td {
  border-bottom: none;
}

.comparison-table tr:hover td {
  background: var(--gray-50);
}

/* === Flow Diagram === */
.flow {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 3rem 0;
  flex-wrap: wrap;
}

.flow-step {
  flex: 1;
  min-width: 200px;
  padding: 1.5rem;
  background: var(--white);
  border: 1px solid var(--gray-200);
  position: relative;
}

.flow-step:first-child {
  border-radius: 12px 0 0 12px;
}

.flow-step:last-child {
  border-radius: 0 12px 12px 0;
}

.flow-step-number {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gray-400);
  margin-bottom: 0.75rem;
}

.flow-step h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.flow-step p {
  font-size: 0.8125rem;
  color: var(--gray-500);
  line-height: 1.5;
}

.flow-arrow {
  display: flex;
  align-items: center;
  padding: 0 0.5rem;
  color: var(--gray-300);
  font-size: 1.25rem;
}

/* === Quick Start === */
.quickstart-steps {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 2rem 0;
}

.quickstart-step {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.quickstart-step-icon {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--gray-400);
  min-width: 1.5rem;
  padding-top: 0.25rem;
}

.quickstart-step code {
  display: block;
  background: var(--gray-900);
  color: var(--gray-100);
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.8125rem;
  width: 100%;
}

.quickstart-step .desc {
  font-size: 0.8125rem;
  color: var(--gray-500);
  margin-top: 0.375rem;
}

/* === Spec Cards === */
.spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.spec-card {
  display: block;
  padding: 1.5rem;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  transition: all 0.2s;
  text-decoration: none;
}

.spec-card:hover {
  border-color: var(--black);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.spec-card-number {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.spec-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

.spec-card p {
  font-size: 0.8125rem;
  color: var(--gray-500);
  line-height: 1.5;
}

/* === Prior Art === */
.prior-art-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.prior-art-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.25rem;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
}

.prior-art-item h4 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.prior-art-item p {
  font-size: 0.8125rem;
  color: var(--gray-500);
  line-height: 1.4;
}

/* === Footer === */
.footer {
  background: var(--gray-900);
  color: var(--gray-400);
  padding: 4rem 2rem 2rem;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem;
}

.footer-brand {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 1rem;
}

.footer-description {
  font-size: 0.875rem;
  line-height: 1.6;
  max-width: 300px;
}

.footer-col h4 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray-500);
  margin-bottom: 1rem;
}

.footer-col a {
  display: block;
  font-size: 0.875rem;
  color: var(--gray-400);
  margin-bottom: 0.625rem;
  transition: color 0.2s;
}

.footer-col a:hover {
  color: var(--white);
}

.footer-bottom {
  max-width: var(--max-width);
  margin: 3rem auto 0;
  padding-top: 2rem;
  border-top: 1px solid var(--gray-800);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
}

@media (max-width: 768px) {
  .footer-inner {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }
  .footer-bottom {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .footer-inner {
    grid-template-columns: 1fr;
  }
}

/* === Docs Page === */
.docs-layout {
  display: flex;
  min-height: calc(100vh - var(--header-height));
  padding-top: var(--header-height);
}

.docs-sidebar {
  width: 280px;
  min-width: 280px;
  border-right: 1px solid var(--gray-200);
  padding: 2rem 1.5rem;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  background: var(--gray-50);
}

.docs-sidebar-title {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray-400);
  margin-bottom: 1rem;
  padding: 0 0.75rem;
}

.docs-sidebar a {
  display: block;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--gray-600);
  border-radius: 6px;
  margin-bottom: 0.125rem;
  transition: all 0.15s;
}

.docs-sidebar a:hover {
  background: var(--gray-200);
  color: var(--black);
}

.docs-sidebar a.active {
  background: var(--black);
  color: var(--white);
}

.docs-content {
  flex: 1;
  padding: 3rem 4rem;
  max-width: 800px;
  min-width: 0;
}

@media (max-width: 900px) {
  .docs-sidebar {
    display: none;
  }
  .docs-content {
    padding: 2rem;
  }
}

/* === Docs Content Typography === */
.docs-content h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.docs-content .subtitle {
  font-size: 1.125rem;
  color: var(--gray-500);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.docs-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 3rem;
  margin-bottom: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--gray-200);
}

.docs-content h2:first-of-type {
  border-top: none;
  padding-top: 0;
}

.docs-content h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.docs-content p {
  margin-bottom: 1rem;
  color: var(--gray-700);
  line-height: 1.7;
}

.docs-content ul, .docs-content ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.docs-content li {
  margin-bottom: 0.375rem;
  color: var(--gray-700);
  line-height: 1.6;
}

.docs-content code:not(pre code) {
  background: var(--gray-100);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-size: 0.8125rem;
  color: var(--gray-800);
}

.docs-content pre {
  background: var(--gray-900);
  color: var(--gray-100);
  padding: 1.25rem 1.5rem;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  font-size: 0.8125rem;
  line-height: 1.7;
}

.docs-content pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
  color: inherit;
}

.code-copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--gray-700);
  border: 1px solid var(--gray-600);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--gray-300);
  opacity: 0;
  transition: opacity 0.15s;
}

div:hover > .code-copy-btn { opacity: 1; }
.code-copy-btn:hover { background: var(--gray-600); color: var(--white); }

.docs-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  overflow: hidden;
}

.docs-content th {
  text-align: left;
  padding: 0.75rem 1rem;
  background: var(--gray-50);
  font-weight: 600;
  border-bottom: 1px solid var(--gray-200);
}

.docs-content td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: top;
}

.docs-content tr:last-child td {
  border-bottom: none;
}

.docs-content blockquote {
  border-left: 3px solid var(--gray-300);
  padding: 0.75rem 1.25rem;
  margin-bottom: 1.5rem;
  color: var(--gray-600);
  font-style: italic;
  background: var(--gray-50);
  border-radius: 0 8px 8px 0;
}

/* === Nav between docs === */
.docs-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--gray-200);
  gap: 1rem;
}

.docs-nav a {
  display: flex;
  flex-direction: column;
  padding: 1rem 1.5rem;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  transition: all 0.2s;
  min-width: 0;
  flex: 1;
}

.docs-nav a:hover {
  border-color: var(--black);
}

.docs-nav a .label {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-bottom: 0.25rem;
}

.docs-nav a .title {
  font-weight: 600;
  font-size: 0.9375rem;
}

.docs-nav a.next {
  text-align: right;
}

/* === Scrollbar === */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* === Problem Section === */
.problem-diagrams {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 2rem 0 3rem;
}

.problem-diagram-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-500);
  margin-bottom: 0.75rem;
}

.problem-points {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 0.5rem;
}

.problem-point {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.problem-point-icon {
  font-size: 1.25rem;
  font-weight: 700;
  min-width: 1.5rem;
  text-align: center;
  line-height: 1.4;
}

.problem-point span {
  font-size: 0.9375rem;
  line-height: 1.6;
}

@media (max-width: 768px) {
  .problem-diagrams {
    grid-template-columns: 1fr;
  }
}

/* === Responsive === */
@media (max-width: 640px) {
  .hero {
    padding-top: calc(var(--header-height) + 3rem);
    padding-bottom: 3rem;
  }
  .section {
    padding: 3rem 1.25rem;
  }
  .section-full {
    padding: 3rem 1.25rem;
  }
  .features-grid {
    grid-template-columns: 1fr;
  }
  .flow {
    flex-direction: column;
  }
  .flow-step:first-child,
  .flow-step:last-child {
    border-radius: 12px;
  }
  .flow-arrow {
    justify-content: center;
    transform: rotate(90deg);
  }
  .spec-grid {
    grid-template-columns: 1fr;
  }
  .prior-art-grid {
    grid-template-columns: 1fr;
  }
  .hero-actions {
    flex-direction: column;
  }
  .header-actions {
    display: none;
  }
}
