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

:root {
  --color-bg: #ffffff;
  --color-text: #1a1a2e;
  --color-text-secondary: #555;
  --color-accent: #2563eb;
  --color-accent-dark: #1d4ed8;
  --color-surface: #f8fafc;
  --color-border: #e2e8f0;
  --color-hero-bg: #0f172a;
  --color-hero-text: #f1f5f9;
  --color-hero-sub: #94a3b8;
  --color-card-bg: #ffffff;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --container-width: 960px;
  --container-wide: 1100px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.7;
  font-size: 16px;
}

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

a:hover {
  color: var(--color-accent-dark);
}

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

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

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

/* === Navigation === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
}

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

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

.nav-logo-text {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-text);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.nav-links a {
  color: var(--color-text-secondary);
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--color-accent);
}

/* === Hero Section === */
.hero {
  background: var(--color-hero-bg);
  color: var(--color-hero-text);
  text-align: center;
  padding: 1rem 1.5rem 1rem;
}

.hero-logo {
  width: 640px;
  margin-bottom: 1rem;
  border-radius: 24px;
}

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

.hero .tagline {
  font-size: 1.25rem;
  color: var(--color-hero-sub);
  max-width: 850px;
  margin: 0 auto 1rem;
  line-height: 1;
}

.hero .authors {
  font-size: 0.95rem;
  color: var(--color-hero-sub);
  margin-bottom: 1rem;
}

.hero .authors a {
  color: var(--color-hero-sub);
  border-bottom: 1px dotted var(--color-hero-sub);
}

.hero .authors a:hover {
  color: #fff;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s;
}

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

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

.btn-outline {
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  color: var(--color-hero-text);
}

.btn-outline:hover {
  border-color: rgba(255, 255, 255, 0.6);
  color: #fff;
}

/* === Sections === */
.section {
  padding: 2rem 0;
}

.section-alt {
  background: var(--color-surface);
}

.section h2 {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.25rem;
  letter-spacing: -0.01em;
}

.section .section-subtitle {
  text-align: center;
  color: var(--color-text-secondary);
  max-width: 600px;
  margin: 0 auto 1rem;
  font-size: 1.05rem;
}

/* === TLDR === */
.tldr {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1rem;
  margin: 1.5rem auto;
  max-width: var(--container-width);
}

.tldr h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0rem;
  color: var(--color-accent);
}

.tldr ul {
  list-style: none;
  padding: 0;
}

.tldr li {
  padding: 0.3rem 0;
  padding-left: 1.5rem;
  position: relative;
}

.tldr li::before {
  content: ">";
  position: absolute;
  left: 0;
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-weight: 600;
}

/* === Video === */
.video-wrapper {
  max-width: 800px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.video-wrapper video {
  width: 100%;
  display: block;
}

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

.feature-card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.75rem;
  transition: box-shadow 0.2s, transform 0.2s;
}

.feature-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.feature-card .icon {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
  display: block;
}

.feature-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

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

/* === Map Video Cards === */
.maps-video-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-top: 1rem;
}

.map-video-card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
}

.map-video-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.map-video-wrapper {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #000;
}

.map-video-wrapper video {
  width: 100%;
  display: block;
}

.map-label {
  position: absolute;
  bottom: 0.6rem;
  left: 0.6rem;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  backdrop-filter: blur(4px);
}

/* === Architecture Diagram === */
.architecture-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
  margin: 1rem 0;
}

.arch-step {
  background: var(--color-hero-bg);
  color: var(--color-hero-text);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  text-align: center;
  flex: 1 1 0;
  white-space: nowrap;
}

.arch-step .step-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-hero-sub);
  margin-bottom: 0.2rem;
}

.arch-step .step-title {
  font-weight: 600;
  font-size: 0.85rem;
}

.arch-arrow {
  font-size: 1.2rem;
  color: var(--color-text-secondary);
}

/* === API Table === */
.api-table-wrapper {
  overflow-x: auto;
  margin: 2rem 0;
}

.api-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

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

.api-table th {
  font-weight: 600;
  background: var(--color-surface);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-secondary);
}

.api-table code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--color-surface);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.api-table .method {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.8rem;
}

.method-get { color: #16a34a; }
.method-post { color: #2563eb; }
.method-delete { color: #dc2626; }

/* === Code Block === */
.code-block {
  background: var(--color-hero-bg);
  color: #e2e8f0;
  border-radius: 10px;
  padding: 1.5rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.7;
  margin: 1.5rem 0;
}

.code-block .comment {
  color: #64748b;
}

.code-block .keyword {
  color: #c084fc;
}

.code-block .string {
  color: #86efac;
}

.code-block .function {
  color: #93c5fd;
}

/* === Results Table === */
.results-table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.95rem;
}

.results-table th,
.results-table td {
  padding: 0.85rem 1.25rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.results-table th {
  font-weight: 600;
  background: var(--color-surface);
}

.results-table tr:hover {
  background: var(--color-surface);
}

.results-table a {
  font-weight: 500;
}

/* === How It Works === */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.step {
  text-align: center;
  padding: 1.5rem;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--color-accent);
  color: #fff;
  border-radius: 50%;
  font-weight: 700;
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.step h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

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

/* === Acknowledgments === */
.acknowledgments {
  text-align: center;
  padding: 1rem 0;
  color: var(--color-text-secondary);
  font-size: 0.95rem;
}

.acknowledgments a {
  font-weight: 500;
}

/* === Footer === */
.site-footer {
  text-align: center;
  padding: 1.5rem 1.5rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.9rem;
  color: var(--color-text-secondary);
}

.site-footer a {
  font-weight: 500;
}

.footer-sub {
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

/* === Responsive === */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 2rem;
  }

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

  .nav-links {
    display: none;
  }

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

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

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

  .features-grid,
  .maps-video-grid,
  .steps {
    grid-template-columns: 1fr;
  }
}

/* === Markdown-rendered elements === */
.container table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

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

.container th {
  font-weight: 600;
  background: var(--color-surface);
}

.container tr:hover {
  background: var(--color-surface);
}

.container pre {
  background: var(--color-hero-bg);
  color: #e2e8f0;
  border-radius: 10px;
  padding: 1.5rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.7;
  margin: 1.5rem 0;
}

.container code {
  font-family: var(--font-mono);
  font-size: 0.88em;
}

.container p code {
  background: var(--color-surface);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85em;
}

/* === Leaderboard Embed === */
.leaderboard-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  justify-content: center;
}

.leaderboard-tab {
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  border: 1.5px solid var(--color-border);
  background: var(--color-card-bg);
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.leaderboard-tab:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.leaderboard-tab.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

.leaderboard-frame-wrapper {
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
  background: #0f172a;
}

.leaderboard-frame-wrapper iframe {
  width: 100%;
  height: 600px;
  border: none;
  display: block;
}

/* === Citation === */
.citation-block {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  max-width: var(--container-width);
  margin: 1.5rem auto;
}
