/* ================================================================
   AILANG Parse Design System
   Warm cream + emerald palette | Source Serif 4 headlines + DM Sans body
   ================================================================ */

/* -- Variables -- */
:root {
  /* ── Brand palette (emerald-first) ── */
  --emerald: #00b37a;
  --emerald-deep: #009966;
  --emerald-light: #00cc8a;
  --lime: #b8e600;
  --lime-deep: #8ab300;
  --coral: #ff6b47;
  --coral-light: #f25d3b;
  --coral-deep: #e73c17;
  --coral-faded: rgba(255, 107, 71, 0.08);
  --blue: #47b0ff;
  --purple: #a47aff;

  /* Legacy --primary aliases — point to emerald */
  --primary: #00b37a;
  --primary-light: #00cc8a;
  --primary-dark: #009966;
  --primary-faded: rgba(0, 179, 122, 0.08);

  /* Misc accent aliases retained for legacy */
  --charcoal: #314352;
  --charcoal-light: #3d5468;
  --indigo: #4f46e5;
  --indigo-light: #6366f1;
  --contract-purple: #8b5cf6;
  --contract-purple-bg: rgba(139, 92, 246, 0.1);
  --ai-orange: #f59e0b;
  --ai-orange-bg: rgba(245, 158, 11, 0.1);

  /* ── Surfaces ── */
  --bg: #faf8f4;
  --bg-alt: #f0ece4;
  --bg-dark: #1a1915;
  --bg-dark2: #252219;
  --cream: #f0ece4;
  --bg-card: #ffffff;
  --bg-code: #0f172a;
  --bg-input: #f1f5f9;
  --border: rgba(26, 25, 21, 0.08);
  --border-active: rgba(26, 25, 21, 0.16);
  --border-dark: rgba(255, 255, 255, 0.08);

  /* ── Text ── */
  --ink: #1a1915;
  --ink-soft: #6b6860;
  --ink-faint: #a8a49c;
  --text-primary: #1a1915;
  --text-secondary: #6b6860;
  --text-muted: #a8a49c;

  /* ── Status ── */
  --success: #059669;
  --success-bg: #ecfdf5;
  --warning: #d97706;
  --warning-bg: #fffbeb;

  /* ── Color aliases retained for legacy code ── */
  --teal: #0d9488;
  --teal-bg: rgba(13, 148, 136, 0.08);
  --blue-bg: rgba(71, 176, 255, 0.08);
  --purple-bg: rgba(164, 122, 255, 0.08);
  --amber: #d97706;
  --amber-bg: rgba(217, 119, 6, 0.08);
  --green: #16a34a;
  --pink: #db2777;

  /* Radius scale */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 12px;

  /* Shadow scale */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 28px rgba(0,0,0,0.10), 0 4px 10px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 40px rgba(0,0,0,0.12), 0 8px 16px rgba(0,0,0,0.06);
  --shadow-emerald: 0 8px 24px rgba(0, 179, 122, 0.12);
  --shadow-blue: 0 8px 24px rgba(0, 179, 122, 0.12); /* alias retained for legacy code */

  /* Animation */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);

  /* ── Typography ── */
  --font-display: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-headline: 'Source Serif 4', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Menlo', monospace;
}

/* Editorial serif for top-level headings */
h1, h2, h3 {
  font-family: var(--font-headline);
  letter-spacing: -0.02em;
}

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

body {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* -- Header bar -- */
.header {
  background: linear-gradient(135deg, #0c1a2e 0%, #162338 50%, #0c1a2e 100%);
  color: #fff;
  padding: 0 32px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: nowrap;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2), 0 0 20px rgba(0, 179, 122, 0.04);
  border-bottom: 1px solid rgba(0, 179, 122, 0.12);
  position: sticky;
  top: 0;
  z-index: 100;
}
/* Blue accent line at bottom — echoes card top-stripe motif */
.header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 10%, rgba(0, 179, 122, 0.3) 50%, transparent 90%);
}

.nav-home { display: flex; align-items: center; }
.nav-home:hover .header-logo { opacity: 0.8; }
.header img.header-logo {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 4px;
  transition: opacity 0.15s;
}

.header-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.3px;
  white-space: nowrap;
}

.header-title .ai { color: var(--primary-light); }

.dp-beta-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 100px;
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.3);
  margin-left: 6px;
  vertical-align: middle;
  line-height: 1.4;
}

.header-sep {
  width: 1px;
  height: 24px;
  background: rgba(255,255,255,0.15);
  margin: 0 4px;
}

.header-subtitle {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.3px;
}

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

.header-nav a {
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
}

.header-nav a:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-right a {
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  transition: color 0.2s;
  white-space: nowrap;
}

.header-right a:hover { color: #fff; }

/* Auth avatar + dropdown in header */
.dp-header-auth { position: relative; }
.dp-header-auth-btn {
  display: flex; align-items: center; gap: 8px;
  background: none; border: none; cursor: pointer;
  padding: 4px 8px; border-radius: 6px;
  transition: background 0.15s;
  color: rgba(255,255,255,0.75);
}
.dp-header-auth-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.dp-header-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2);
  object-fit: cover;
}
.dp-header-user-name {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dp-header-auth-menu {
  display: none;
  position: absolute; right: 0; top: calc(100% + 6px);
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; min-width: 200px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  z-index: 200; overflow: hidden;
}
.dp-header-auth.open .dp-header-auth-menu { display: block; }
.dp-header-auth-email {
  padding: 12px 16px 8px;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.dp-header-auth-item {
  display: block; width: 100%; padding: 10px 16px;
  font-family: var(--font-mono); font-size: 12px;
  color: var(--text-secondary); text-decoration: none;
  background: none; border: none; cursor: pointer;
  text-align: left; transition: background 0.15s, color 0.15s;
}
.dp-header-auth-item:hover {
  background: var(--bg-input); color: var(--text-primary);
}

.header-badge {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.header-badge code {
  background: rgba(255,255,255,0.1);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  color: rgba(255,255,255,0.7);
}

/* -- Header responsive: progressive collapse before mobile breakpoint -- */
@media (max-width: 1200px) {
  .header { gap: 10px; padding: 0 20px; }
  .header-subtitle { display: none; }
  .header-sep { display: none; }
  .header-nav a { padding: 4px 7px; }
}
@media (max-width: 1050px) {
  .header { gap: 8px; padding: 0 16px; }
  .header-nav a { font-size: 10px; padding: 4px 6px; }
  .header-right a { font-size: 10px; }
  .dp-beta-badge { display: none; }
}

/* -- Page layout -- */
.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 32px 48px;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 56px);
}

/* -- Hero -- */
.hero { text-align: center; margin-bottom: 40px; }

.hero h1 {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.hero h1 .accent { color: var(--primary); }
.hero .subtitle { font-size: 16px; color: var(--text-secondary); margin-bottom: 20px; }

.hero-tags {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.hero .note {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.hero .note code {
  color: var(--primary);
  background: var(--primary-faded);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
}

/* -- Tags -- */
.tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 14px;
  border-radius: 100px;
  border: 1px solid;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.tag--wasm { color: var(--blue); border-color: rgba(0, 179, 122,0.25); background: var(--blue-bg); }
.tag--streaming { color: var(--teal); border-color: rgba(13,148,136,0.25); background: var(--teal-bg); }
.tag--contracts { color: var(--contract-purple); border-color: rgba(139,92,246,0.25); background: var(--contract-purple-bg); }
.tag--budgets { color: var(--amber); border-color: rgba(217,119,6,0.25); background: var(--ai-orange-bg); }
.tag--effects { color: var(--teal); border-color: rgba(13,148,136,0.25); background: var(--teal-bg); }
.tag--formats { color: var(--blue); border-color: rgba(0, 179, 122,0.25); background: var(--blue-bg); }
.tag--ai { color: var(--amber); border-color: rgba(217,119,6,0.25); background: var(--ai-orange-bg); }

/* -- Section -- */
.section { margin-bottom: 40px; }

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.section-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-input);
  padding: 2px 8px;
  border-radius: 100px;
}

.section-link {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
  letter-spacing: 0.3px;
}

.section-link:hover { color: var(--primary); }

.section-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.6;
}

/* -- Card Grid -- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  flex: 1;
}

/* -- Cards -- */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 22px 20px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.25s ease, box-shadow 0.3s ease, border-color 0.25s ease;
  cursor: pointer;
  opacity: 0;
  transform: translateY(18px);
  animation: fadeInUp 0.5s ease forwards;
}

@keyframes fadeInUp {
  to { opacity: 1; transform: translateY(0); }
}

.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.10s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.20s; }
.card:nth-child(5) { animation-delay: 0.25s; }
.card:nth-child(6) { animation-delay: 0.30s; }
.card:nth-child(7) { animation-delay: 0.35s; }

.card:hover {
  transform: scale(1.01);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0, 179, 122, 0.08);
  border-color: rgba(0, 179, 122, 0.2);
}
.card:hover::before {
  box-shadow: 0 0 8px currentColor;
}

/* Top accent stripe */
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
}

/* -- Card accent colors -- */
.card--extractor::before { background: var(--primary); }
.card--docparse::before { background: var(--blue); }
.card--verify::before { background: var(--purple); }
.card--contracts::before { background: var(--contract-purple); }
.card--claude::before { background: var(--amber); }
.card--live::before { background: linear-gradient(90deg, var(--amber), #e88a30); }
.card--safe::before { background: var(--success); }
.card--vdocparse::before { background: var(--blue); }
.card--ecommerce::before { background: var(--teal); }
.card--website::before { background: linear-gradient(90deg, var(--purple), var(--pink)); }

/* -- Card icons -- */
.card-icon {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: 20px;
  line-height: 1;
}

.card--extractor .card-icon { background: var(--primary-faded); color: var(--primary); }
.card--docparse .card-icon { background: var(--blue-bg); color: var(--blue); }
.card--verify .card-icon { background: var(--purple-bg); color: var(--purple); }
.card--contracts .card-icon { background: var(--contract-purple-bg); color: var(--contract-purple); }
.card--claude .card-icon { background: var(--ai-orange-bg); color: var(--amber); }
.card--live .card-icon { background: var(--ai-orange-bg); color: var(--amber); }
.card--safe .card-icon { background: var(--success-bg); color: var(--success); }
.card--vdocparse .card-icon { background: var(--blue-bg); color: var(--blue); }
.card--ecommerce .card-icon { background: var(--teal-bg); color: var(--teal); }
.card--website .card-icon { background: var(--purple-bg); color: var(--purple); }

.card-icon svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.8;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  letter-spacing: -0.2px;
}

.card-desc {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.5;
  flex: 1;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: auto;
}

/* -- Badges -- */
.badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.badge-wasm { background: var(--blue-bg); color: var(--blue); }
.badge-ws { background: var(--success-bg); color: var(--success); }
.badge-sse { background: var(--warning-bg); color: var(--warning); }
.badge-rest { background: var(--bg-input); color: var(--text-muted); }
.badge-provider { background: var(--bg-input); color: var(--text-muted); }
.badge-key { background: var(--primary-faded); color: var(--primary); font-size: 9px; }
.badge-cli { background: var(--blue-bg); color: var(--blue); }

/* -- Card arrow on hover -- */
.card-arrow {
  position: absolute;
  top: 24px;
  right: 22px;
  color: var(--text-muted);
  font-size: 16px;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.2s, transform 0.2s;
  font-family: var(--font-mono);
}

.card:hover .card-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* -- Footer -- */
.footer {
  text-align: center;
  padding: 40px 0 0;
  margin-top: auto;
  border-top: 1px solid var(--border);
}

.footer-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 6px;
}

.footer-brand svg { width: 22px; height: 22px; }
.footer-brand span { font-family: var(--font-display); font-weight: 700; font-size: 13px; color: var(--text-secondary); }
.footer-brand .ai { color: var(--primary); }

.footer-line {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  line-height: 2;
}

.footer-line a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

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

.footer-sep {
  display: inline-block;
  width: 1px;
  height: 10px;
  background: var(--border);
  margin: 0 10px;
  vertical-align: middle;
}

.footer-version {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--text-muted, #888);
  opacity: 0.6;
}

/* -- Section Intro Panel -- */
.section-intro {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.section-intro::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
}

.section-intro--docs::before { background: var(--blue); }
.section-intro--streaming::before { background: var(--teal); }
.section-intro--website::before { background: var(--purple); }
.section-intro--data::before { background: var(--teal); }

.section-intro-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}

.section-intro-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.section-intro-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 16px;
  max-width: 680px;
}

.section-intro-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  padding: 8px 20px;
  border: 2px solid var(--primary);
  border-radius: var(--radius-sm);
  transition: background 0.2s, color 0.2s;
}

.section-intro-cta:hover {
  background: var(--primary);
  color: #fff;
}

/* -- Responsive -- */
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .hero h1 { font-size: 28px; }
  .page { padding: 32px 20px 40px; }
  .header { padding: 0 20px; }
  .header-subtitle { display: none; }
  .header-nav { display: none; }
}

@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; gap: 14px; }
  .hero h1 { font-size: 24px; }
  .hero .subtitle { font-size: 14px; }
  .page { padding: 24px 16px 32px; }
  .card { padding: 20px 18px 18px; }
  .header-badge { display: none; }
  .section-intro { padding: 20px 20px; }
  .section-intro-title { font-size: 18px; }
}
