/* Prism Engine — Landing Page Styles */

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

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-card: #1c2129;
  --border: #30363d;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79b8ff;
  --accent-glow: rgba(88, 166, 255, 0.15);
  --green: #3fb950;
  --yellow: #e3a832;
  --purple: #bc8cff;
  --mono: "SF Mono", "Cascadia Code", "Fira Code", "JetBrains Mono", Consolas,
    monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial,
    sans-serif;
  --max-width: 1200px;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

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

section {
  scroll-margin-top: 4.5rem;
}

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

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

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

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

/* ── Skip Link ──────────────────────────────────────── */

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 200;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--bg-primary);
  border-radius: 0 0 8px 8px;
  font-weight: 600;
  font-size: 0.875rem;
}

.skip-link:focus {
  top: 0;
  color: var(--bg-primary);
}

/* ── Nav ────────────────────────────────────────────── */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
}

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

.nav-logo {
  font-family: var(--mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.nav-logo span {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

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

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

/* ── Hero ───────────────────────────────────────────── */

.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6rem 2rem 4rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: -40%;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(
    circle,
    var(--accent-glow) 0%,
    transparent 70%
  );
  pointer-events: none;
}

.hero-badge {
  display: inline-block;
  padding: 0.375rem 1rem;
  border: 1px solid var(--border);
  border-radius: 9999px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  background: var(--bg-secondary);
}

.hero h1 {
  font-family: var(--mono);
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 1.5rem;
}

.hero h1 span {
  background: linear-gradient(135deg, var(--accent), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-tagline {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--text-secondary);
  max-width: 640px;
  margin-bottom: 2.5rem;
}

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

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

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

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

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border);
}

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

/* ── Sections ───────────────────────────────────────── */

section {
  padding: 5rem 2rem;
}

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

.section-label {
  font-family: var(--mono);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.section-title {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 700;
  margin-bottom: 1rem;
}

.section-desc {
  color: var(--text-secondary);
  max-width: 640px;
  margin-bottom: 3rem;
}

/* ── Demo ───────────────────────────────────────────── */

.demo-wrapper {
  position: relative;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  aspect-ratio: 16 / 10;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
}

.demo-wrapper canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.demo-fallback[hidden] {
  display: none;
}

.demo-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.demo-caption {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* ── Demo sections (full-viewport iframes) ──────────── */

#gltf-demo,
#demo {
  padding: 0;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}

.gltf-wasm-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.gltf-demo-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.6;
  background: var(--bg-secondary);
}

.gltf-demo-overlay {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 8rem 2rem 3rem;
  background: linear-gradient(
    to top,
    rgba(13, 17, 23, 0.92) 0%,
    rgba(13, 17, 23, 0.4) 60%,
    transparent 100%
  );
  /* Pass pointer events through to the iframe canvas below. Links inside remain clickable. */
  pointer-events: none;
}

.gltf-demo-overlay a {
  pointer-events: auto;
}

.gltf-demo-overlay .section-desc {
  margin-bottom: 1.5rem;
}

/* ── Features ───────────────────────────────────────── */

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

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

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

.feature-icon {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
  display: block;
  width: 40px;
  height: 40px;
  line-height: 40px;
  text-align: center;
  border-radius: 8px;
  background: var(--accent-glow);
  font-family: var(--mono);
  color: var(--accent);
  font-weight: 700;
}

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

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

/* ── Architecture ───────────────────────────────────── */

.arch-diagram {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  overflow-x: auto;
}

.arch-diagram pre {
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--text-primary);
}

.arch-diagram .dim {
  color: var(--text-secondary);
}

.arch-diagram .hl {
  color: var(--accent);
}

.arch-diagram .hl-green {
  color: var(--green);
}

.arch-diagram .hl-purple {
  color: var(--purple);
}

/* ── Platform Table ─────────────────────────────────── */

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

.platform-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--border);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.platform-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

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

.status-done {
  color: var(--green);
  font-weight: 600;
}

.status-wip {
  color: var(--yellow);
  font-weight: 600;
}

.status-planned {
  color: var(--text-secondary);
}

/* ── Milestones ─────────────────────────────────────── */

.milestones {
  display: grid;
  gap: 0;
}

.milestone {
  display: grid;
  grid-template-columns: 80px 24px 1fr;
  gap: 1rem;
  align-items: start;
  padding: 1rem 0;
}

.milestone-tag {
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: right;
  padding-top: 0.125rem;
}

.milestone-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.milestone-dot::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.milestone-dot::after {
  content: "";
  width: 2px;
  flex-grow: 1;
  min-height: 32px;
  background: var(--border);
}

.milestone:last-child .milestone-dot::after {
  display: none;
}

.milestone.done .milestone-tag {
  color: var(--green);
}

.milestone.done .milestone-dot::before {
  background: var(--green);
}

.milestone.wip .milestone-tag {
  color: var(--yellow);
}

.milestone.wip .milestone-dot::before {
  background: var(--yellow);
  box-shadow: 0 0 8px var(--yellow);
}

.milestone.planned .milestone-tag {
  color: var(--text-secondary);
}

.milestone.planned .milestone-dot::before {
  background: var(--border);
}

.milestone-text h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 0.125rem;
}

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

/* ── API Examples ───────────────────────────────────── */

#api {
  background: var(--bg-secondary);
}

.lang-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.lang-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.lang-label {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 0.5rem 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  user-select: none;
}


.lang-card pre.code-block {
  background: transparent;
  border: none;
  border-radius: 0;
}

@media (max-width: 720px) {
  .lang-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Quick Start ────────────────────────────────────── */

.quickstart-steps {
  display: grid;
  gap: 1.5rem;
}

.quickstart-step h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-glow);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 700;
  flex-shrink: 0;
}

pre.code-block {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.6;
}

pre.code-block .comment {
  color: var(--text-secondary);
}

pre.code-block .cmd {
  color: var(--green);
}

/* ── Footer ─────────────────────────────────────────── */

.footer {
  border-top: 1px solid var(--border);
  padding: 3rem 2rem;
  text-align: center;
}

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

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

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

.footer-links a:hover {
  color: var(--text-primary);
}

/* ── Responsive ─────────────────────────────────────── */

@media (max-width: 768px) {
  .nav-links {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  section {
    padding: 3rem 1.25rem;
  }

  .hero {
    padding: 5rem 1.25rem 3rem;
  }

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

  .milestone {
    grid-template-columns: 56px 24px 1fr;
  }

  .platform-table {
    font-size: 0.8125rem;
  }

  .platform-table th,
  .platform-table td {
    padding: 0.5rem 0.625rem;
  }
}

@media (max-width: 480px) {
  .hero-buttons {
    flex-direction: column;
    width: 100%;
  }

  .btn {
    justify-content: center;
  }
}
