/* ==========================================================================
   Template Repo -- GitHub Pages Site
   Single-file stylesheet: variables, reset, layout, components, responsive
   ========================================================================== */

/* ---------- Custom Properties ---------- */
:root {
  --bg-primary: #0d1117;
  --bg-surface: #161b22;
  --bg-hover: #21262d;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --accent-blue: #58a6ff;
  --accent-green: #3fb950;
  --accent-orange: #d29922;
  --accent-purple: #bc8cff;
  --border: #30363d;
  --nav-height: 64px;
  --container-max: 1200px;
  --section-gap: 6rem;
  --radius: 8px;
  --radius-lg: 12px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-height);
}

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: "JetBrains Mono", monospace;
  line-height: 1.3;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: #79c0ff;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.875em;
  background: var(--bg-hover);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

/* ---------- Accessibility ---------- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  background: var(--accent-blue);
  color: var(--bg-primary);
  padding: 0.5rem 1rem;
  z-index: 1000;
  font-weight: 600;
  border-radius: 0 0 var(--radius) 0;
}

.skip-link:focus {
  top: 0;
}

:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* ---------- Layout ---------- */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.5rem;
}

section {
  padding: var(--section-gap) 0;
}

.section-title {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: 1.125rem;
  max-width: 700px;
  margin-bottom: 2.5rem;
}

/* ---------- Navbar ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}

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

.nav-brand {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.nav-brand:hover {
  color: var(--accent-blue);
}

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

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

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

.nav-links a.active::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-blue);
  border-radius: 1px;
}

/* Mobile menu toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

/* ---------- Hero ---------- */
.hero {
  padding: 5rem 0 4rem;
  text-align: center;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  margin-bottom: 1rem;
}

.hero-accent {
  color: var(--accent-blue);
}

.hero-tagline {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 720px;
  margin: 0 auto 2.5rem;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

.stat {
  text-align: center;
}

.stat-number {
  font-family: "JetBrains Mono", monospace;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent-blue);
  display: block;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hero-cta {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 3rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9375rem;
  transition: background 0.2s, transform 0.15s;
  border: none;
  cursor: pointer;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent-blue);
  color: var(--bg-primary);
}

.btn-primary:hover {
  background: #79c0ff;
  color: var(--bg-primary);
}

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

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

.hero-demo {
  max-width: 800px;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}

.hero-demo img {
  width: 100%;
}

/* ---------- Cards Grid ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: border-color 0.2s, transform 0.2s;
}

.card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-2px);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.card-description {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-bottom: 1rem;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2em 0.6em;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: "JetBrains Mono", monospace;
}

.badge-rust {
  background: rgba(215, 95, 42, 0.15);
  color: #d75f2a;
}

.badge-python {
  background: rgba(53, 114, 165, 0.15);
  color: #3572a5;
}

.badge-provider {
  background: rgba(88, 166, 255, 0.15);
  color: var(--accent-blue);
}

.badge-category {
  background: rgba(139, 148, 158, 0.1);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.badge-transport {
  background: rgba(63, 185, 80, 0.1);
  color: var(--accent-green);
}

/* ---------- Overview ---------- */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.overview-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.overview-card h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

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

.notice {
  background: rgba(210, 153, 34, 0.08);
  border: 1px solid rgba(210, 153, 34, 0.3);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-top: 2rem;
}

.notice-title {
  color: var(--accent-orange);
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.notice p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* ---------- Architecture Diagram ---------- */
.arch-diagram {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  overflow-x: auto;
  margin-bottom: 2rem;
}

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

.arch-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1rem;
  min-width: 120px;
}

.arch-step-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  border: 2px solid var(--border);
  background: var(--bg-primary);
}

.arch-step-icon.human {
  border-color: var(--accent-green);
  color: var(--accent-green);
}

.arch-step-icon.agent {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.arch-step-icon.ai {
  border-color: var(--accent-purple);
  color: var(--accent-purple);
}

.arch-step-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
}

.arch-step-sub {
  font-size: 0.6875rem;
  color: var(--text-secondary);
}

.arch-arrow {
  font-size: 1.25rem;
  color: var(--text-secondary);
  flex-shrink: 0;
  padding: 0 0.25rem;
}

.arch-legend {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.arch-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.arch-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* ---------- Filter Buttons (MCP) ---------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.filter-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.filter-btn:hover {
  border-color: var(--accent-blue);
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--accent-blue);
  color: var(--bg-primary);
  border-color: var(--accent-blue);
}

/* ---------- Publications ---------- */
.pub-group {
  margin-bottom: 2.5rem;
}

.pub-group-title {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.pub-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pub-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  gap: 1rem;
  transition: border-color 0.2s;
}

.pub-item:hover {
  border-color: var(--accent-blue);
}

.pub-info {
  flex: 1;
  min-width: 0;
}

.pub-title {
  font-weight: 600;
  font-size: 0.9375rem;
  margin-bottom: 0.2rem;
}

.pub-topic {
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.pub-links {
  display: flex;
  gap: 0.75rem;
  flex-shrink: 0;
}

.pub-link {
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
}

/* ---------- Tools Table ---------- */
.tools-table-wrap {
  overflow-x: auto;
}

.tools-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.tools-table th {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--border);
}

.tools-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.tools-table tr:hover td {
  background: var(--bg-surface);
}

.tools-table code {
  font-size: 0.8125rem;
  white-space: nowrap;
}

/* ---------- CI/CD Pipeline ---------- */
.pipeline-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
}

.pipeline-stages {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.pipeline-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.75rem;
  min-width: 100px;
}

.pipeline-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  color: var(--bg-primary);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.pipeline-name {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.6875rem;
  color: var(--text-primary);
  font-weight: 600;
}

.pipeline-connector {
  width: 24px;
  height: 2px;
  background: var(--border);
  flex-shrink: 0;
}

.pipeline-info {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
}

.pipeline-info-item h4 {
  font-size: 0.875rem;
  margin-bottom: 0.35rem;
}

.pipeline-info-item p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* ---------- AI Safety ---------- */
.safety-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.safety-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.safety-card h3 {
  font-size: 1rem;
  color: var(--accent-green);
  margin-bottom: 0.5rem;
}

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

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 3rem 0;
  text-align: center;
}

.footer-text {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  margin-bottom: 0.5rem;
}

.footer-disclaimer {
  color: var(--text-secondary);
  font-size: 0.75rem;
  max-width: 700px;
  margin: 1rem auto 0;
  opacity: 0.7;
}

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

.footer-links a {
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

/* ---------- Scroll Reveal ---------- */
/* Visible by default for no-JS; JS adds .js to <html> to enable animation */
.js .reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.js .reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  :root {
    --section-gap: 4rem;
  }
}

@media (max-width: 768px) {
  :root {
    --section-gap: 3rem;
  }

  /* Mobile layout: stack links vertically for all users */
  .nav-links {
    flex-direction: column;
    padding: 1rem 1.5rem;
    gap: 0;
  }

  /* Gate collapsed/hidden state on .js so no-JS users still see links */
  .js .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: rgba(13, 17, 23, 0.97);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
  }

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

  .nav-links li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
  }

  .nav-links li:last-child {
    border-bottom: none;
  }

  .js .nav-toggle {
    display: block;
  }

  .hero-stats {
    gap: 1.5rem;
  }

  .stat-number {
    font-size: 2rem;
  }

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

  .card-grid {
    grid-template-columns: 1fr;
  }

  .arch-flow {
    flex-direction: column;
  }

  .arch-arrow {
    transform: rotate(90deg);
  }

  .pipeline-stages {
    flex-direction: column;
    align-items: stretch;
  }

  .pipeline-connector {
    width: 2px;
    height: 16px;
    align-self: center;
  }

  .pub-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .pub-links {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 1.75rem;
  }

  .hero-tagline {
    font-size: 1rem;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .hero-cta {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .card,
  .btn,
  a {
    transition: none;
  }

  .stat-number {
    /* counters will show final value immediately */
    transition: none;
  }
}
