/* ============================================================
   IDX — CSS
   Palette derived from internal/adapters/handlers/tui/palette.go
   ============================================================ */

:root {
  --bg:        #0F172A;
  --surface:   #1E293B;
  --surface2:  #263348;
  --border:    #334155;
  --text:      #CBD5E1;
  --muted:     #64748B;
  --path:      #94A3B8;
  --primary:   #6366F1;
  --secondary: #818CF8;
  --accent:    #FBBF24;
  --success:   #34D399;
  --selected:  #3730A3;
  --error:     #F87171;

  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', ui-monospace, monospace;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --radius:    8px;
  --radius-lg: 12px;
  --sidebar-w: 240px;
  --header-h:  56px;
}

/* ============================================================
   Reset
   ============================================================ */

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

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

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

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

/* ============================================================
   Shared — Header
   ============================================================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}

.site-header .logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: #F8FAFC;
  text-decoration: none;
}

.site-header .logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--primary);
  border-radius: 6px;
  font-size: 0.8rem;
  color: #fff;
  font-weight: 800;
}

.site-header nav { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.site-header nav a {
  font-size: 0.875rem;
  color: var(--path);
  padding: 6px 12px;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
  text-decoration: none;
}

.site-header nav a:hover { color: var(--text); background: var(--surface); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--path);
  padding: 6px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  text-decoration: none;
}
.btn-ghost:hover { color: var(--text); border-color: var(--muted); background: var(--surface); text-decoration: none; }

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--path);
  margin-left: auto;
}

/* --- Nav dropdown --- */

.nav-dropdown {
  position: relative;
}

.nav-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.875rem;
  font-family: var(--font-sans);
  color: var(--path);
  padding: 6px 12px;
  border-radius: var(--radius);
  border: none;
  background: none;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.nav-dropdown-trigger:hover,
.nav-dropdown[data-open] .nav-dropdown-trigger {
  color: var(--text);
  background: var(--surface);
}

.dropdown-chevron {
  transition: transform 0.2s;
  opacity: 0.6;
}

.nav-dropdown[data-open] .dropdown-chevron { transform: rotate(180deg); }

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(99,102,241,0.08);
  overflow: hidden;
  z-index: 200;
}

.nav-dropdown[data-open] .nav-dropdown-menu { display: block; }

.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  text-decoration: none;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border);
}

.nav-dropdown-item:last-child { border-bottom: none; }
.nav-dropdown-item:hover { background: var(--surface2); text-decoration: none; }

.nav-dropdown-icon { font-size: 1.1rem; flex-shrink: 0; }

.nav-dropdown-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-dropdown-text strong {
  font-size: 0.875rem;
  font-weight: 600;
  color: #F8FAFC;
}

.nav-dropdown-text span {
  font-size: 0.75rem;
  color: var(--muted);
}

/* ============================================================
   Shared — Footer
   ============================================================ */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--secondary); }
.site-footer .footer-links { display: flex; justify-content: center; gap: 24px; flex-wrap: wrap; margin-bottom: 12px; }

/* ============================================================
   Shared — Code blocks
   ============================================================ */

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--surface);
  color: var(--secondary);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  overflow-x: auto;
  line-height: 1.7;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
  font-size: 0.9rem;
}

/* Shell prompt styling inside pre blocks */
pre code .prompt { color: var(--success); }
pre code .cmd    { color: var(--secondary); }
pre code .arg    { color: var(--accent); }
pre code .comment { color: var(--muted); }

/* ============================================================
   Landing — Layout
   ============================================================ */

.landing-page { overflow-x: hidden; }

/* --- Hero --- */

.hero {
  min-height: calc(100vh - var(--header-h));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 24px 100px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% -10%, rgba(99,102,241,0.2) 0%, transparent 70%),
    radial-gradient(ellipse 40% 30% at 80% 80%, rgba(251,191,36,0.06) 0%, transparent 60%);
  pointer-events: none;
}


.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: #F8FAFC;
  margin-bottom: 20px;
  max-width: 14ch;
}

.hero h1 span {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--path);
  margin-bottom: 16px;
  max-width: 56ch;
}

.hero-pills {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.pill {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 20px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 60px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 24px;
  border-radius: var(--radius);
  transition: background 0.15s, transform 0.1s;
  text-decoration: none;
}
.btn-primary:hover { background: #4F46E5; color: #fff; text-decoration: none; transform: translateY(-1px); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  text-decoration: none;
}
.btn-secondary:hover { border-color: var(--secondary); background: var(--surface); color: var(--text); text-decoration: none; transform: translateY(-1px); }

/* Hero terminal mockup */
.hero-terminal {
  width: 100%;
  max-width: 580px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-align: left;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5), 0 0 0 1px rgba(99,102,241,0.1);
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
}

.terminal-dot {
  width: 10px; height: 10px; border-radius: 50%;
}
.terminal-dot.red   { background: #F87171; }
.terminal-dot.amber { background: #FBBF24; }
.terminal-dot.green { background: #34D399; }
.terminal-title { flex: 1; text-align: center; font-size: 0.75rem; color: var(--muted); font-family: var(--font-mono); }

.terminal-body {
  padding: 20px 24px;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 2;
  overflow-x: auto;
}

.terminal-body::-webkit-scrollbar        { height: 4px; }
.terminal-body::-webkit-scrollbar-track  { background: transparent; }
.terminal-body::-webkit-scrollbar-thumb  { background: var(--border); border-radius: 2px; }
.terminal-body::-webkit-scrollbar-thumb:hover { background: var(--muted); }

.t-prompt { color: var(--success); }
.t-cmd    { color: #F8FAFC; }
.t-arg    { color: var(--accent); }
.t-path   { color: var(--secondary); }
.t-score  { color: var(--success); }
.t-muted  { color: var(--muted); }
.t-line   { display: block; margin: 2px 0; white-space: nowrap; }

/* --- Features section --- */

.section {
  padding: 96px 24px;
  max-width: 1100px;
  margin: 0 auto;
}

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

/* ============================================================
   Landing — AI agents text block
   ============================================================ */

.ai-text-block {
  max-width: 680px;
  margin-bottom: 48px;
}

.ai-text-block p {
  font-size: 1rem;
  color: var(--path);
  line-height: 1.8;
  margin-bottom: 16px;
}

.ai-benefits {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 56px;
}

.ai-benefit {
  border-left: 2px solid var(--primary);
  padding-left: 20px;
}

.ai-benefit-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: #F8FAFC;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.ai-benefit p {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}

/* Editor cards */

.editor-intro {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 16px;
}

.editor-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.editor-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.2s, transform 0.15s;
}

.editor-card:hover { transform: translateY(-2px); }

.editor-card--claude  { border-top: 2px solid var(--primary); }
.editor-card--cursor  { border-top: 2px solid #8B5CF6; }
.editor-card--copilot { border-top: 2px solid #3B82F6; }

.editor-card-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #F8FAFC;
}

.editor-install {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--secondary);
  background: rgba(99,102,241,0.08);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  display: block;
}

/* ============================================================
   Landing — Skills / AI IDE stat cards
   ============================================================ */

.ai-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 56px;
}

.ai-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.15s;
}

.ai-stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.ai-stat-card:hover { border-color: rgba(99,102,241,0.4); transform: translateY(-2px); }

.ai-stat-num {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 700;
  color: #F8FAFC;
  line-height: 1;
  letter-spacing: -0.03em;
}

.ai-stat-unit {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--secondary);
}

.ai-stat-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 4px;
}

.ai-stat-desc {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ============================================================
   Landing — sections
   ============================================================ */

.section-title {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 700;
  color: #F8FAFC;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.section-sub {
  color: var(--path);
  font-size: 1.05rem;
  max-width: 56ch;
  margin-bottom: 56px;
}

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

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: border-color 0.2s, transform 0.2s;
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  opacity: 0;
  transition: opacity 0.2s;
}

.feature-card:hover { border-color: rgba(99,102,241,0.4); transform: translateY(-2px); }
.feature-card:hover::before { opacity: 1; }

.feature-icon {
  width: 40px; height: 40px;
  background: rgba(99,102,241,0.12);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  margin-bottom: 16px;
}

.feature-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #F8FAFC;
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 0.9rem;
  color: var(--path);
  line-height: 1.6;
}

/* --- Quick start section --- */

.quickstart-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

.quickstart-wrap > * { min-width: 0; }

.quickstart-steps { display: flex; flex-direction: column; gap: 24px; }

.qs-step {
  display: flex;
  gap: 16px;
}

.qs-step-body { min-width: 0; }

.qs-num {
  flex-shrink: 0;
  width: 28px; height: 28px;
  background: rgba(99,102,241,0.15);
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--secondary);
  font-family: var(--font-mono);
}

.qs-step-body h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #F8FAFC;
  margin-bottom: 4px;
}

.qs-step-body p {
  font-size: 0.875rem;
  color: var(--path);
}

/* ============================================================
   Docs — Layout
   ============================================================ */

.docs-shell {
  display: flex;
  min-height: calc(100vh - var(--header-h));
}

/* Sidebar */
.docs-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  border-right: 1px solid var(--border);
  padding: 24px 0;
  background: var(--bg);
}

.sidebar-section { margin-bottom: 8px; }

.sidebar-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 8px 20px 4px;
}

.sidebar-nav { list-style: none; }

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 20px;
  font-size: 0.875rem;
  color: var(--path);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
  border-left: 2px solid transparent;
}

.sidebar-nav li a:hover {
  color: var(--text);
  background: var(--surface);
  text-decoration: none;
}

.sidebar-nav li a.active {
  color: var(--secondary);
  background: rgba(99,102,241,0.08);
  border-left-color: var(--primary);
  font-weight: 500;
}

.sidebar-nav li a .nav-icon {
  font-size: 0.8rem;
  opacity: 0.7;
  width: 16px;
  text-align: center;
}

/* Docs content */
.docs-content {
  flex: 1;
  min-width: 0;
  padding: 48px 64px;
  max-width: 860px;
}

/* Docs typography */
.docs-body h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #F8FAFC;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.docs-body h2 {
  font-size: 1.3rem;
  font-weight: 600;
  color: #F8FAFC;
  margin: 40px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.docs-body h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin: 28px 0 8px;
}

.docs-body h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--path);
  margin: 20px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--font-mono);
}

.docs-body p { margin-bottom: 16px; color: var(--text); }

.docs-body ul, .docs-body ol {
  margin: 0 0 16px 20px;
  color: var(--text);
}

.docs-body li { margin-bottom: 6px; line-height: 1.6; }

.docs-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 0.9rem;
}

.docs-body th {
  text-align: left;
  padding: 10px 16px;
  background: var(--surface);
  color: var(--secondary);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.docs-body td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: top;
}

.docs-body tr:last-child td { border-bottom: none; }
.docs-body tr:hover td { background: rgba(255,255,255,0.02); }

.docs-body blockquote {
  border-left: 3px solid var(--primary);
  margin: 20px 0;
  padding: 12px 20px;
  background: rgba(99,102,241,0.06);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--path);
  font-style: italic;
}

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

.docs-body strong { color: #F8FAFC; font-weight: 600; }


/* ============================================================
   Sidebar — latest badge
   ============================================================ */

.sidebar-latest {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--success);
  background: rgba(52,211,153,0.1);
  border: 1px solid rgba(52,211,153,0.2);
  padding: 1px 6px;
  border-radius: 20px;
  margin-left: auto;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 900px) {
  .quickstart-wrap { grid-template-columns: minmax(0, 1fr); }
  .ai-benefits { grid-template-columns: 1fr; }
  .editor-cards { grid-template-columns: 1fr; }
  .docs-content { padding: 32px 24px; }
  .ai-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .hamburger { display: flex; }

  .docs-sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    height: calc(100vh - var(--header-h));
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
  }

  .docs-sidebar.open { transform: translateX(0); }

  .docs-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    top: var(--header-h);
    background: rgba(0,0,0,0.5);
    z-index: 49;
  }

  .docs-sidebar-overlay.open { display: block; }

  .site-header nav { display: none; }
  .site-header .hamburger { display: flex; }
}

@media (max-width: 480px) {
  .hero-actions { flex-direction: column; align-items: stretch; }
  .btn-primary, .btn-secondary { justify-content: center; }
  .features-grid { grid-template-columns: 1fr; }
  .ai-stat-grid { grid-template-columns: 1fr; }
}
