/* ===============================================================
   pi-forge GitHub Pages site

   Adapted from the multiplex docs site (../../multiplex/docs/site/),
   recolored with an emerald accent that matches the app's "context
   goes to LLM" indicator. Same dark surface palette as the
   pi-forge UI itself so the site reads as part of the same
   product.

   Loaded by:
     - docs/site/index.html       (landing)
     - docs/site/docs/*.html      (every generated doc page)

   Generated docs reference this via `../style.css`. Don't move it
   without updating scripts/build-site.mjs's chromeDocs template.
   =============================================================== */

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

:root {
  --bg: #0a0a0c;
  --bg-surface: #101012;
  --bg-card: #16161a;
  --bg-card-hover: #1c1c22;
  --bg-code: #0d0d10;
  --border: #25252e;
  --border-light: #2e2e3a;
  --text: #e6e7eb;
  --text-secondary: #989aa6;
  --text-muted: #5f6172;
  --accent: #10b981;
  --accent-light: #34d399;
  --accent-glow: rgba(16, 185, 129, 0.15);
  --accent-gradient: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --max-width: 1140px;
  --header-height: 64px;
}

html { scroll-behavior: smooth; }

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

a { color: var(--accent-light); text-decoration: none; transition: color 0.2s; }
a:hover { color: #6ee7c8; }

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

/* === Header / Nav === */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-height);
  background: rgba(10, 10, 12, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.logo svg, .logo img { width: 28px; height: 28px; }

.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--text); }

.nav-cta {
  background: var(--accent-gradient);
  color: #0a0a0c !important;
  padding: 8px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  transition: opacity 0.2s;
}
.nav-cta:hover { opacity: 0.9; color: #0a0a0c !important; }

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
}

/* === Hero === */
.hero {
  padding: 160px 24px 100px;
  text-align: center;
  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-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.hero-badge span { color: var(--accent-light); font-weight: 600; }

.hero h1 {
  font-size: clamp(36px, 6vw, 60px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}

.hero h1 .gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 640px;
  margin: 0 auto 40px;
  line-height: 1.7;
}

.hero-buttons { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.btn-primary {
  background: var(--accent-gradient);
  color: #0a0a0c;
  padding: 14px 28px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 15px;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); color: #0a0a0c; }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  padding: 14px 28px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 15px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--border-light); transform: translateY(-1px); }

/* === Demo / GIF area === */
.demo-section {
  max-width: var(--max-width);
  margin: -20px auto 80px;
  padding: 0 24px;
}

.demo-window {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.demo-titlebar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.demo-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}
.demo-dot.red { background: #ff5f57; }
.demo-dot.yellow { background: #ffbd2e; }
.demo-dot.green { background: #28c840; }

.demo-content {
  padding: 0;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
}

.demo-content img {
  width: 100%;
  height: auto;
  display: block;
}

/* === Carousel (hero screenshots) === */
.carousel {
  position: relative;
  width: 100%;
  background: #0a0a0a;
}
.carousel-viewport {
  width: 100%;
  overflow: hidden;
}
.carousel-track {
  position: relative;
  width: 100%;
  /* Aspect-ratio reservation so layout doesn't jump while images load.
     Matches the source ratio (~16:10 from a Mac viewport capture). */
  aspect-ratio: 16 / 10;
}
.carousel-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0a0a0a;
  opacity: 0;
  transition: opacity 0.45s ease-in-out;
  pointer-events: none;
}
.carousel-slide.active {
  opacity: 1;
  pointer-events: auto;
}
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.55);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  transition: opacity 0.2s, background 0.2s;
}
.carousel-btn:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.8);
}
.carousel-prev { left: 14px; }
.carousel-next { right: 14px; }
.carousel-dots {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 999px;
}
.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: background 0.2s;
}
.carousel-dot:hover { background: rgba(255, 255, 255, 0.6); }
.carousel-dot.active { background: var(--accent-light, #fff); }

/* === Sections === */
.section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 80px 24px;
}

.section-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-light);
  margin-bottom: 14px;
}

.section h2 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.section > p {
  color: var(--text-secondary);
  font-size: 17px;
  max-width: 800px;
  margin-bottom: 48px;
}

/* === Feature Grid === */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  /* `1fr` rows + cards stretching to fill their cell makes every
     row in the grid uniform — without this the tallest card in a
     row wins and the others stay compact, giving the grid a ragged
     bottom edge. */
  grid-auto-rows: 1fr;
  gap: 20px;
  align-items: stretch;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  transition: border-color 0.3s, background 0.3s, transform 0.2s;
  /* Stretch to fill the grid cell so cards in the same row match
     heights. Without this, cards size to their content. */
  height: 100%;
  display: flex;
  flex-direction: column;
}

.feature-card:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.feature-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--accent-glow);
  border: 1px solid rgba(16, 185, 129, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  font-size: 20px;
}

.feature-card h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 8px;
}

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

/* === Quick Start === */
.quickstart-steps { display: flex; flex-direction: column; gap: 24px; }

.qs-step {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.qs-number {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-glow);
  border: 1px solid rgba(16, 185, 129, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: var(--accent-light);
  margin-top: 2px;
}

.qs-content { flex: 1; min-width: 0; }
.qs-content h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.qs-content p { font-size: 14px; color: var(--text-secondary); margin-bottom: 12px; }
.qs-content pre { margin-bottom: 12px; }

/* === Code Blocks === */
pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

:not(pre) > code {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.85em;
  color: var(--text);
}

.code-comment { color: var(--text-muted); }
.code-string { color: #a8d8a8; }
.code-cmd { color: var(--accent-light); }

/* === Comparison === */
.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.comparison-col {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.comparison-header {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.comparison-before { color: var(--text-muted); border-bottom-color: var(--text-muted); }
.comparison-after { color: var(--accent-light); border-bottom-color: var(--accent); }

.comparison-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comparison-list li {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  padding-left: 22px;
  position: relative;
}

.comparison-before + .comparison-list li::before {
  content: '\2717';
  position: absolute;
  left: 0;
  color: var(--text-muted);
}

.comparison-after + .comparison-list li::before {
  content: '\2713';
  position: absolute;
  left: 0;
  color: var(--accent-light);
}

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

/* === Footer === */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 48px 24px;
  margin-top: 80px;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-inner p {
  color: var(--text-muted);
  font-size: 14px;
}

.footer-links { display: flex; gap: 24px; flex-wrap: wrap; }
.footer-links a { color: var(--text-secondary); font-size: 14px; }

/* === Docs Layout === */
.docs-layout {
  display: flex;
  min-height: calc(100vh - var(--header-height));
  padding-top: var(--header-height);
}

.docs-sidebar {
  width: 260px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 32px 20px;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  background: var(--bg-surface);
}

.sidebar-section { margin-bottom: 28px; }
.sidebar-section h4 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 10px;
  padding-left: 12px;
}

.sidebar-section a {
  display: block;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-secondary);
  transition: color 0.2s, background 0.2s;
}

.sidebar-section a:hover {
  color: var(--text);
  background: var(--bg-card);
}

.sidebar-section a.active {
  color: var(--accent-light);
  background: var(--accent-glow);
}

.docs-main {
  flex: 1;
  min-width: 0;
  padding: 40px 48px 80px;
  max-width: 880px;
}

.docs-main h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.docs-main .docs-subtitle {
  font-size: 17px;
  color: var(--text-secondary);
  margin-bottom: 40px;
}

.docs-main h2 {
  font-size: 22px;
  font-weight: 700;
  margin-top: 48px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.docs-main h3 {
  font-size: 17px;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 12px;
}

.docs-main h4 {
  font-size: 15px;
  font-weight: 600;
  margin-top: 24px;
  margin-bottom: 8px;
}

.docs-main p { margin-bottom: 16px; color: var(--text); font-size: 15px; }
.docs-main ul, .docs-main ol { margin-bottom: 16px; padding-left: 24px; }
.docs-main li { margin-bottom: 6px; font-size: 15px; color: var(--text); }
.docs-main li code { font-size: 13px; }
.docs-main pre { margin-bottom: 20px; }
.docs-main blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 20px;
  margin-bottom: 20px;
  background: var(--accent-glow);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.docs-main blockquote p:last-child { margin-bottom: 0; }

.docs-main hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

/* === Tables === */
.docs-main table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 14px;
}

.docs-main th {
  text-align: left;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.docs-main td {
  padding: 10px 14px;
  border: 1px solid var(--border);
  vertical-align: top;
}

.docs-main td code {
  background: var(--bg-code);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12.5px;
}

/* === Mobile Sidebar Toggle === */
.sidebar-toggle {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-gradient);
  border: none;
  color: #0a0a0c;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
}

/* === Responsive === */
@media (max-width: 900px) {
  .docs-sidebar {
    position: fixed;
    left: -280px;
    top: var(--header-height);
    z-index: 90;
    width: 280px;
    transition: left 0.3s ease;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
  }
  .docs-sidebar.open { left: 0; }
  .sidebar-toggle { display: flex; align-items: center; justify-content: center; }
  .docs-main { padding: 32px 20px 80px; }
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    gap: 12px;
  }
  .mobile-toggle { display: block; }

  .hero { padding: 120px 20px 60px; }
  .hero h1 { font-size: 32px; }
  .hero p { font-size: 16px; }

  .feature-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; text-align: center; }
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }
