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

:root {
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-primary-light: #93c5fd;
  --color-primary-bg: #eff6ff;
  --color-text: #1e293b;
  --color-text-secondary: #475569;
  --color-text-muted: #64748b;
  --color-bg: #ffffff;
  --color-bg-alt: #f8fafc;
  --color-border: #e2e8f0;
  --color-code-bg: #0f172a;
  --color-code-text: #e2e8f0;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --radius: 8px;
  --radius-lg: 12px;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

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

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

a:hover {
  text-decoration: underline;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== Navbar ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
  transition: box-shadow 0.2s;
}

.navbar.scrolled {
  box-shadow: var(--shadow-md);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
}

.nav-logo:hover {
  text-decoration: none;
}

.logo-icon {
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  list-style: none;
}

.nav-links a {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s;
}

.nav-links a:hover {
  color: var(--color-primary);
  text-decoration: none;
}

.nav-github {
  padding: 6px 16px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  transition: all 0.15s;
}

.nav-github:hover {
  background: var(--color-bg-alt);
  border-color: var(--color-text-muted);
}

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

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-text);
  border-radius: 1px;
  transition: all 0.2s;
}

/* ===== Hero ===== */
.hero {
  padding: 140px 0 80px;
  background: linear-gradient(135deg, var(--color-primary-bg) 0%, var(--color-bg) 60%);
}

.hero .container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--color-text);
  margin-bottom: 20px;
}

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
  margin-bottom: 32px;
}

.hero-subtitle a {
  font-weight: 600;
}

.hero-actions {
  display: flex;
  gap: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 12px 28px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius);
  text-decoration: none;
  transition: all 0.15s;
  cursor: pointer;
  border: none;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-primary-dark);
}

.btn-secondary {
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-bg-alt);
  border-color: var(--color-text-muted);
}

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}

.btn-outline:hover {
  background: var(--color-primary);
  color: #fff;
}

/* Hero Diagram */
.hero-visual {
  display: flex;
  justify-content: center;
}

.hero-diagram {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.diagram-layer {
  padding: 16px 32px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  text-align: center;
  min-width: 220px;
  border: 2px solid;
}

.layer-app {
  background: #ede9fe;
  border-color: #a78bfa;
  color: #5b21b6;
}

.layer-controller {
  background: #dbeafe;
  border-color: #60a5fa;
  color: #1e40af;
}

.layer-sidecar {
  background: #d1fae5;
  border-color: #34d399;
  color: #065f46;
}

.layer-storage {
  background: #fef3c7;
  border-color: #fbbf24;
  color: #92400e;
}

.diagram-arrow {
  width: 2px;
  height: 24px;
  background: var(--color-text-muted);
  position: relative;
}

.diagram-arrow::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--color-text-muted);
}

/* ===== Section Titles ===== */
.section-title {
  font-size: 2.25rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.section-subtitle {
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 1.1rem;
  margin-bottom: 56px;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== Features ===== */
.features {
  padding: 100px 0;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.feature-card {
  padding: 32px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  transition: all 0.2s;
}

.feature-card:hover {
  border-color: var(--color-primary-light);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.feature-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.feature-icon svg {
  width: 32px;
  height: 32px;
}

.icon-replication {
  background: #dbeafe;
  color: #2563eb;
}

.icon-reclaim {
  background: #d1fae5;
  color: #059669;
}

.icon-fence {
  background: #fee2e2;
  color: #dc2626;
}

.icon-group {
  background: #ede9fe;
  color: #7c3aed;
}

.icon-encryption {
  background: #fef3c7;
  color: #d97706;
}

.icon-identity {
  background: #e0e7ff;
  color: #4338ca;
}

.feature-card h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.feature-card p {
  color: var(--color-text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

.feature-rpcs {
  display: block;
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.icon-default {
  background: #f1f5f9;
  color: #475569;
}

/* ===== Architecture ===== */
.architecture {
  padding: 100px 0;
  background: var(--color-bg-alt);
}

.arch-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin-bottom: 64px;
}

.arch-component {
  background: var(--color-bg);
  padding: 32px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}

.arch-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--color-primary);
}

.arch-component p {
  color: var(--color-text-secondary);
  font-size: 0.95rem;
  margin-bottom: 16px;
}

.arch-details {
  list-style: none;
  padding: 0;
}

.arch-details li {
  position: relative;
  padding-left: 20px;
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
}

.arch-details li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-primary-light);
}

.arch-flow {
  background: var(--color-bg);
  padding: 40px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}

.arch-flow h3 {
  text-align: center;
  font-size: 1.3rem;
  margin-bottom: 32px;
}

.flow-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex-wrap: wrap;
}

.flow-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}

.flow-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.flow-step p {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  max-width: 160px;
}

.flow-connector {
  width: 40px;
  height: 2px;
  background: var(--color-border);
  position: relative;
}

.flow-connector::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 6px solid var(--color-border);
}

/* ===== Getting Started ===== */
.getting-started {
  padding: 100px 0;
}

.tabs {
  margin-bottom: 48px;
}

.tab-buttons {
  display: flex;
  gap: 4px;
  background: var(--color-bg-alt);
  padding: 4px;
  border-radius: var(--radius);
  width: fit-content;
  margin-bottom: 24px;
}

.tab-btn {
  padding: 10px 24px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-sans);
}

.tab-btn:hover {
  color: var(--color-text);
}

.tab-btn.active {
  background: var(--color-bg);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.tab-content h3 {
  font-size: 1.1rem;
  margin-bottom: 16px;
}

.code-block {
  background: var(--color-code-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid #1e293b;
}

.code-header span {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  text-transform: uppercase;
}

.copy-btn {
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-sans);
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.code-block pre {
  padding: 20px;
  overflow-x: auto;
}

.code-block code {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--color-code-text);
}

.example-cr h3 {
  font-size: 1.3rem;
  margin-bottom: 16px;
}

/* ===== Repositories ===== */
.repositories {
  padding: 100px 0;
  background: var(--color-bg-alt);
}

.repo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.repo-card {
  background: var(--color-bg);
  padding: 28px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  text-decoration: none;
  transition: all 0.2s;
  display: block;
}

.repo-card:hover {
  border-color: var(--color-primary-light);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  transform: translateY(-2px);
}

.repo-icon {
  width: 40px;
  height: 40px;
  color: var(--color-primary);
  margin-bottom: 16px;
}

.repo-icon svg {
  width: 100%;
  height: 100%;
}

.repo-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 8px;
}

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

/* ===== Community ===== */
.community {
  padding: 100px 0;
}

.community-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.community-card {
  text-align: center;
  padding: 40px 32px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.community-card h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.community-card p {
  color: var(--color-text-secondary);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

/* ===== Footer ===== */
.footer {
  background: var(--color-code-bg);
  color: var(--color-code-text);
  padding: 64px 0 0;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  gap: 48px;
  margin-bottom: 48px;
}

.footer-brand p {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-top: 8px;
}

.footer-logo {
  font-size: 1.25rem;
  font-weight: 700;
}

.footer-links {
  display: flex;
  gap: 64px;
}

.footer-col h4 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}

.footer-col ul {
  list-style: none;
}

.footer-col li {
  margin-bottom: 10px;
}

.footer-col a {
  color: var(--color-code-text);
  font-size: 0.9rem;
  transition: color 0.15s;
}

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

.footer-bottom {
  border-top: 1px solid #1e293b;
  padding: 24px 0;
  text-align: center;
}

.footer-bottom p {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.footer-bottom a {
  color: var(--color-primary-light);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .hero .container {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .hero h1 {
    font-size: 2.5rem;
  }

  .features-grid,
  .arch-grid,
  .repo-grid,
  .community-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    flex-direction: column;
    padding: 16px 24px;
    gap: 16px;
    box-shadow: var(--shadow-md);
  }

  .nav-links.open {
    display: flex;
  }

  .hero {
    padding: 120px 0 60px;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 1.05rem;
  }

  .hero-actions {
    flex-direction: column;
  }

  .btn {
    text-align: center;
    justify-content: center;
  }

  .section-title {
    font-size: 1.75rem;
  }

  .features-grid,
  .arch-grid,
  .repo-grid,
  .community-grid {
    grid-template-columns: 1fr;
  }

  .flow-steps {
    flex-direction: column;
    align-items: flex-start;
  }

  .flow-connector {
    width: 2px;
    height: 24px;
    margin-left: 15px;
  }

  .flow-connector::after {
    right: auto;
    left: 50%;
    top: auto;
    bottom: 0;
    transform: translateX(-50%);
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 6px solid var(--color-border);
    border-bottom: none;
  }

  .footer-content {
    flex-direction: column;
    gap: 32px;
  }

  .footer-links {
    flex-direction: column;
    gap: 32px;
  }

  .tab-buttons {
    width: 100%;
  }

  .tab-btn {
    flex: 1;
    text-align: center;
  }

  .arch-flow {
    padding: 24px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .feature-card,
  .arch-component,
  .community-card {
    padding: 24px;
  }
}
