:root {
  --bg: #f4f1ea;
  --fg: #1a1a1a;
  --muted: #6b6560;
  --surface: #eae6dc;
  --surface-2: #ddd8cc;
  --border: #2c2c2c;
  --accent: #c73e1d;
  --accent-2: #5d2e8c;
  --accent-3: #b8860b;
  --code-bg: #eae6dc;
  --code-fg: #1a1a1a;
}

* { box-sizing: border-box; margin: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  font-size: clamp(1.05rem, 0.95rem + 0.3vw, 1.2rem);
  overflow-x: hidden;
}

/* ---------------------------------------------------------------------------
   Typography
   --------------------------------------------------------------------------- */

h1, h2 {
  font-family: "Shrikhand", Georgia, serif;
  font-weight: 400;
  line-height: 1.05;
}

h1 { font-size: clamp(4rem, 10vw + 1rem, 9rem); }
h2 { font-size: clamp(2.5rem, 4vw + 0.5rem, 4.5rem); margin-top: 0; }

h3 {
  font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(1.2rem, 1.5vw + 0.5rem, 1.5rem);
  line-height: 1.3;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------------------
   Navigation
   --------------------------------------------------------------------------- */

.main-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 3px solid var(--border);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--fg);
}

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

.nav-brand-icon {
  color: var(--accent);
  font-size: 1.5rem;
  line-height: 1;
}

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

.nav-link {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
  transition: color 0.15s ease;
}

.nav-link:hover {
  color: var(--accent);
  text-decoration: none;
}

.nav-link-gh {
  background: var(--accent);
  color: var(--bg);
  padding: 0.4em 1.2em;
  border-radius: 4px;
  font-size: 0.8rem;
}

.nav-link-gh:hover {
  background: var(--accent-2);
  color: var(--bg);
}

@media (max-width: 640px) {
  .nav-links { display: none; }
}

/* ---------------------------------------------------------------------------
   Hero
   --------------------------------------------------------------------------- */

.hero {
  position: relative;
  padding: clamp(5rem, 12vh, 10rem) clamp(1.25rem, 4vw, 3rem) clamp(4rem, 8vh, 7rem);
  text-align: center;
  overflow: hidden;
  border-bottom: 3px solid var(--border);
}

.hero-pretitle {
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
  margin-bottom: 1rem;
}

.hero h1 {
  color: var(--fg);
  text-shadow: 5px 5px 0 var(--accent);
  line-height: 0.9;
}

.hero-rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 1.5rem 0;
  color: var(--border);
  font-size: 1.2rem;
}

.hero-rule::before,
.hero-rule::after {
  content: "";
  flex: 1;
  max-width: 120px;
  height: 3px;
  background: var(--border);
}

.hero p {
  font-size: clamp(1.2rem, 2vw + 0.5rem, 1.8rem);
  color: var(--muted);
  margin-top: 0.5rem;
  max-width: 32ch;
  margin-left: auto;
  margin-right: auto;
  font-weight: 600;
}

.hero .badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-2);
  border: 2px solid var(--border);
  padding: 0.5em 1.2em;
  margin-top: 2rem;
  background: var(--surface);
}

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

.btn-primary,
.btn-secondary {
  display: inline-block;
  padding: 0.7rem 1.75rem;
  border-radius: 4px;
  font-weight: 600;
  font-size: 1rem;
  transition: transform 0.15s ease;
  border: 3px solid var(--border);
  cursor: pointer;
}

.btn-primary:hover,
.btn-secondary:hover {
  text-decoration: none;
  transform: translateY(-2px);
}

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

.btn-primary:hover {
  background: #a83216;
}

.btn-secondary {
  background: var(--bg);
  color: var(--fg);
}

.btn-secondary:hover {
  background: var(--surface);
}

/* ---------------------------------------------------------------------------
   Sections & scroll reveal
   --------------------------------------------------------------------------- */

section {
  position: relative;
  padding: clamp(5rem, 10vh, 8rem) clamp(1.25rem, 4vw, 3rem);
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
  border-bottom: 3px solid var(--border);
}

section:last-of-type {
  border-bottom: none;
}

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

section h2 {
  margin-bottom: 0.5em;
  max-width: 900px;
}

section > p,
.intro-text {
  max-width: 65ch;
  margin-bottom: 1.5em;
  color: var(--muted);
  font-size: 1.15rem;
}

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

/* ---------------------------------------------------------------------------
   Feature cards
   --------------------------------------------------------------------------- */

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 3rem;
}

.feature-card {
  background: var(--surface);
  border: 3px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
  transition: transform 0.2s ease;
}

.feature-card:hover {
  transform: translateY(-4px) rotate(-0.5deg);
}

.feature-card:nth-child(1) {
  border-color: var(--accent);
}

.feature-card:nth-child(2) {
  border-color: var(--accent-2);
}

.feature-card:nth-child(3) {
  border-color: var(--accent-3);
}

.feature-card:nth-child(4) {
  border-color: var(--border);
}

.feature-card h3 {
  font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  margin-bottom: 0.5em;
  color: var(--fg);
}

.feature-card p {
  font-size: 1rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.6;
}

/* ---------------------------------------------------------------------------
   Example playground (2-column code + live demo)
   --------------------------------------------------------------------------- */

.example-playground {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1.5rem;
  margin: 2rem 0;
  align-items: start;
}

.code-col .code-example {
  margin: 0;
}

.demo-col {
  background: var(--surface);
  border: 3px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  min-height: 200px;
}

.demo-col-label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
}

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

/* ---------------------------------------------------------------------------
   Code examples
   --------------------------------------------------------------------------- */

.code-example {
  margin: 2rem 0;
  border: 3px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

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

.code-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg);
}

.code-lang {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: var(--bg);
  padding: 0.25em 0.6em;
  border-radius: 4px;
  border: 2px solid var(--border);
}

.code-block {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 1.5rem 1.75rem;
  overflow-x: auto;
  font-family: "Space Mono", "SF Mono", Monaco, "Cascadia Code", monospace;
  font-size: 0.9rem;
  line-height: 1.7;
}

.code-block code {
  background: transparent;
  padding: 0;
  border-radius: 0;
  color: inherit;
}

.code-block .k { color: #c73e1d; font-weight: 700; }
.code-block .s { color: #5d2e8c; }
.code-block .c { color: #8a8175; }
.code-block .f { color: #b8860b; font-weight: 700; }
.code-block .n { color: #2c5f2d; }

/* ---------------------------------------------------------------------------
   Pipeline / How It Works
   --------------------------------------------------------------------------- */

.pipeline {
  display: flex;
  align-items: stretch;
  gap: 1.5rem;
  margin-top: 3rem;
  flex-wrap: wrap;
}

.pipeline-step {
  flex: 1 1 220px;
  background: var(--surface);
  border: 3px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  transition: transform 0.2s ease;
}

.pipeline-step:hover {
  transform: translateY(-4px) rotate(0.5deg);
}

.pipeline-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  font-family: "Shrikhand", Georgia, serif;
  font-weight: 400;
  font-size: 1.1rem;
  margin-bottom: 1rem;
  border: 3px solid var(--border);
}

.pipeline-step h3 {
  font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.5em;
}

.pipeline-step p {
  font-size: 0.95rem;
  margin: 0;
  color: var(--muted);
}

.pipeline-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--accent);
  font-weight: 700;
  align-self: center;
}

@media (max-width: 768px) {
  .pipeline-arrow { display: none; }
}

/* ---------------------------------------------------------------------------
   Quick Start
   --------------------------------------------------------------------------- */

.quickstart {
  background: var(--surface);
  border: 3px solid var(--border);
  border-radius: 8px;
  padding: clamp(2rem, 4vw, 3rem);
  margin-top: 2rem;
}

.quickstart h3 {
  font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  font-weight: 700;
  margin-bottom: 1em;
  font-size: 1.1rem;
}

.code-snippet {
  position: relative;
  margin-bottom: 2rem;
}

.code-snippet pre {
  background: var(--bg);
  color: var(--code-fg);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  font-family: "Space Mono", "SF Mono", Monaco, "Cascadia Code", monospace;
  font-size: 0.95rem;
  line-height: 1.7;
  overflow-x: auto;
}

.copy-btn {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  background: var(--surface);
  color: var(--muted);
  border: 2px solid var(--border);
  border-radius: 4px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.copy-btn:hover {
  background: var(--border);
  color: var(--bg);
}

.copy-btn.copied {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* ---------------------------------------------------------------------------
   Benchmarks
   --------------------------------------------------------------------------- */

.benchmark-table-wrap {
  overflow-x: auto;
  margin-top: 2rem;
  border: 3px solid var(--border);
  border-radius: 8px;
}

.benchmark-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

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

.benchmark-table th {
  background: var(--surface);
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--muted);
}

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

.benchmark-table td:first-child {
  font-weight: 800;
}

.benchmark-table .highlight {
  color: var(--accent);
  font-weight: 800;
}

/* ---------------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------------- */

footer {
  padding: 4rem clamp(1.25rem, 4vw, 3rem) 3rem;
  border-top: 3px solid var(--border);
  background: var(--surface);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3rem;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.footer-col h4 {
  font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--fg);
}

.footer-col p {
  font-size: 1rem;
  color: var(--muted);
  margin: 0;
}

.footer-col a {
  display: block;
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
  transition: color 0.15s ease;
}

.footer-col a:hover {
  color: var(--accent);
  text-decoration: none;
}

.footer-bottom {
  max-width: 1200px;
  margin: 0 auto;
  padding-top: 2rem;
  border-top: 2px solid var(--border);
  text-align: left;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 640px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

/* ---------------------------------------------------------------------------
   Layer stack (Architecture)
   --------------------------------------------------------------------------- */

.layer-stack {
  margin: 3rem 0;
  border: 3px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.layer {
  display: flex;
  align-items: stretch;
  background: var(--surface);
  border-bottom: 3px solid var(--border);
}

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

.layer-num {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 4rem;
  font-family: "Shrikhand", Georgia, serif;
  font-size: 1.5rem;
  color: var(--bg);
  background: var(--border);
  border-right: 3px solid var(--border);
}

.layer-app .layer-num {
  background: var(--accent);
}

.layer-compiler .layer-num {
  background: var(--accent-2);
}

.layer-runtime .layer-num {
  background: var(--accent-3);
  color: var(--bg);
}

.layer-body {
  padding: 1.25rem 1.5rem;
  flex: 1;
}

.layer-body h4 {
  font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.25em;
  color: var(--fg);
}

.layer-body p {
  font-family: "Space Mono", "SF Mono", Monaco, "Cascadia Code", monospace;
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
}

/* ---------------------------------------------------------------------------
   Inline code
   --------------------------------------------------------------------------- */

code {
  font-family: "Space Mono", "SF Mono", Monaco, "Cascadia Code", monospace;
  font-size: 0.88em;
  background: var(--surface-2);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--accent-2);
}

/* ---------------------------------------------------------------------------
   Demo rows
   --------------------------------------------------------------------------- */

.demo-row {
  background: var(--surface);
  border: 3px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem 2rem;
  margin-top: 1.25rem;
  margin-bottom: 1.25rem;
}

.demo-row h4 {
  font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.demo-row button {
  background: var(--accent);
  color: var(--bg);
  border: 3px solid var(--border);
  border-radius: 4px;
  padding: 0.6rem 1.25rem;
  font-family: "Space Mono", Monaco, "Cascadia Code", monospace;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.15s ease;
  margin-right: 0.75rem;
  font-weight: 700;
}

.demo-row button:hover {
  transform: translateY(-2px);
  background: #a83216;
}

.demo-row span {
  color: var(--fg);
  font-weight: 700;
  font-family: "Space Mono", Monaco, "Cascadia Code", monospace;
}

.demo-input-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.demo-input-row label {
  font-weight: 700;
  font-size: 1rem;
}

.demo-input-row input[type="text"] {
  background: var(--bg);
  border: 3px solid var(--border);
  border-radius: 4px;
  padding: 0.6rem 1rem;
  font-family: inherit;
  font-size: 1rem;
  color: var(--fg);
  min-width: 220px;
  transition: border-color 0.2s ease;
}

.demo-input-row input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
}

.demo-meta {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.demo-highlight {
  color: var(--accent-2);
  font-weight: 700;
}

.demo-muted {
  color: var(--muted);
}

/* ---------------------------------------------------------------------------
   Reduced motion
   --------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  section { opacity: 1; transform: none; }
}
