/* ============================================
   OpenCEM Platform — Clean Light Academic Theme
   ============================================ */

/* ---------- Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ---------- CSS Variables ---------- */
:root {
  --color-bg: #ffffff;
  --color-bg-alt: #f8fafc;
  --color-bg-card: #ffffff;
  --color-surface: #f1f5f9;
  --color-border: #e2e8f0;
  --color-text: #1e293b;
  --color-text-secondary: #64748b;
  --color-text-muted: #94a3b8;
  --color-primary: #2563eb;
  --color-primary-light: #dbeafe;
  --color-primary-dark: #1d4ed8;
  --color-accent: #059669;
  --color-accent-light: #d1fae5;
  --color-orange: #f59e0b;
  --color-orange-light: #fef3c7;
  --color-purple: #7c3aed;
  --color-purple-light: #ede9fe;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --max-width: 1200px;
  --nav-height: 64px;
}

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

html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.7;
  font-size: 16px;
  overflow-x: hidden;
}

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

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

h1, h2, h3, h4, h5 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-text);
}

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

/* ---------- Utility ---------- */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }
.section { padding: 80px 0; }
.section-alt { background: var(--color-bg-alt); }
.text-center { text-align: center; }
.text-muted { color: var(--color-text-secondary); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-primary { background: var(--color-primary-light); color: var(--color-primary); }
.badge-accent { background: var(--color-accent-light); color: var(--color-accent); }
.badge-orange { background: var(--color-orange-light); color: #b45309; }
.badge-purple { background: var(--color-purple-light); color: var(--color-purple); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 1px 3px rgba(37,99,235,0.3);
}
.btn-primary:hover {
  background: var(--color-primary-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}
.btn-outline {
  background: transparent;
  color: var(--color-text);
  border: 1.5px solid var(--color-border);
}
.btn-outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-light);
}
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }

/* ---------- Navigation ---------- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  z-index: 1000;
  transition: box-shadow 0.3s;
}
.navbar.scrolled { box-shadow: var(--shadow-md); }

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

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.nav-logo { height: 36px; width: auto; }
.nav-brand-text {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
}
.nav-brand-text span { color: var(--color-primary); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}

a.nav-link {
  color: var(--color-text-secondary);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}
a.nav-link:hover { color: var(--color-primary); background: var(--color-primary-light); }
a.nav-link.active { color: var(--color-primary); background: var(--color-primary-light); font-weight: 600; }

.nav-cta {
  background: var(--color-primary);
  color: #fff !important;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
}
.nav-cta:hover { background: var(--color-primary-dark); color: #fff !important; }

/* Mobile nav */
.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; }
.nav-toggle svg { width: 24px; height: 24px; stroke: var(--color-text); }

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    padding: 12px;
    box-shadow: var(--shadow-lg);
  }
  .nav-links.open { display: flex; }
  a.nav-link { width: 100%; padding: 12px 16px; }
}

/* ---------- Hero (Landing) ---------- */
.hero {
  padding: 140px 0 80px;
  background: linear-gradient(135deg, #f0f7ff 0%, #e8f4f8 50%, #f0fdf4 100%);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37,99,235,0.06) 0%, transparent 70%);
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(5,150,105,0.05) 0%, transparent 70%);
  pointer-events: none;
}

.hero .container { position: relative; z-index: 1; }

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(37,99,235,0.08);
  border: 1px solid rgba(37,99,235,0.15);
  border-radius: 24px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 20px;
}

.hero h1 {
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 16px;
  color: var(--color-text);
}
.hero h1 .highlight {
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--color-text-secondary);
  max-width: 680px;
  line-height: 1.7;
  margin-bottom: 32px;
}

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.hero-visual {
  margin-top: 60px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
}
.hero-visual img, .hero-visual video {
  width: 100%;
  display: block;
}

/* ---------- Stats Strip ---------- */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-top: -40px;
  position: relative;
  z-index: 2;
}
.stat-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow-md);
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-primary);
  letter-spacing: -0.02em;
}
.stat-label { font-size: 0.85rem; color: var(--color-text-secondary); margin-top: 4px; font-weight: 500; }

/* ---------- Feature Cards ---------- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.feature-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
}
.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-primary);
}
.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  opacity: 0;
  transition: opacity 0.25s;
}
.feature-card:hover::before { opacity: 1; }

.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 16px;
}
.feature-icon.blue { background: var(--color-primary-light); }
.feature-icon.green { background: var(--color-accent-light); }
.feature-icon.orange { background: var(--color-orange-light); }
.feature-icon.purple { background: var(--color-purple-light); }

.feature-card h3 { font-size: 1.1rem; margin-bottom: 8px; }
.feature-card p { font-size: 0.92rem; color: var(--color-text-secondary); line-height: 1.6; }
.feature-card .feature-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 16px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-primary);
}

/* ---------- Section Headers ---------- */
.section-header {
  max-width: 640px;
  margin-bottom: 48px;
}
.section-header.centered { margin-left: auto; margin-right: auto; text-align: center; }
.section-header h2 {
  font-size: 2rem;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}
.section-header p {
  font-size: 1.05rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
}

/* ---------- Architecture Diagram ---------- */
.architecture-block {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-md);
}
.architecture-block img {
  width: 100%;
  border-radius: var(--radius-md);
}
.architecture-caption {
  margin-top: 16px;
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  text-align: center;
  font-style: italic;
}

/* ---------- Publication Cards ---------- */
.pub-card {
  display: flex;
  gap: 20px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 16px;
  transition: all 0.2s;
}
.pub-card:hover { box-shadow: var(--shadow-md); border-color: var(--color-primary); }
.pub-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}
.pub-card h4 { font-size: 1rem; margin-bottom: 4px; }
.pub-card .pub-authors { font-size: 0.85rem; color: var(--color-text-secondary); margin-bottom: 8px; }
.pub-card .pub-venue { font-size: 0.8rem; color: var(--color-text-muted); font-style: italic; }
.pub-links { display: flex; gap: 8px; margin-top: 10px; }
.pub-links a {
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  font-weight: 500;
  transition: all 0.2s;
}
.pub-links a:hover { border-color: var(--color-primary); color: var(--color-primary); background: var(--color-primary-light); }

/* ---------- Hardware Specs ---------- */
.specs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.spec-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
}
.spec-card h4 {
  font-size: 0.95rem;
  color: var(--color-primary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.spec-card ul { list-style: none; }
.spec-card li {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  padding: 3px 0;
  border-bottom: 1px solid var(--color-surface);
}
.spec-card li:last-child { border-bottom: none; }
.spec-card li strong { color: var(--color-text); font-weight: 500; }

/* ---------- Code Blocks ---------- */
.code-block {
  background: #1e293b;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 16px 0;
}
.code-header {
  background: #334155;
  padding: 10px 16px;
  font-size: 0.8rem;
  color: #94a3b8;
  font-family: var(--font-mono);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.code-header .copy-btn {
  background: none;
  border: 1px solid #475569;
  color: #94a3b8;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  font-family: var(--font-sans);
  transition: all 0.2s;
}
.code-header .copy-btn:hover { border-color: #60a5fa; color: #60a5fa; }
.code-body {
  padding: 16px 20px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.7;
  white-space: pre;
}
.code-body code {
  color: #e2e8f0;
  font-family: var(--font-mono);
  white-space: pre;
  display: block;
}
.code-body .kw { color: #c084fc; }
.code-body .fn { color: #60a5fa; }
.code-body .str { color: #86efac; }
.code-body .cm { color: #64748b; }
.code-body .num { color: #fbbf24; }
.code-body .op { color: #f472b6; }

/* ---------- Interactive Dashboard ---------- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}
.chart-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.chart-card h3 {
  font-size: 1rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.chart-card.full-width { grid-column: 1 / -1; }
.chart-card canvas { width: 100% !important; height: 300px !important; }

/* ---------- Tab System ---------- */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 24px;
}
.tab-btn {
  padding: 10px 20px;
  border: none;
  background: none;
  color: var(--color-text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  font-family: var(--font-sans);
}
.tab-btn:hover { color: var(--color-text); }
.tab-btn.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.tab-content { display: none; animation: fadeIn 0.3s ease; }
.tab-content.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- API Endpoint Cards ---------- */
.endpoint-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  overflow: hidden;
}
.endpoint-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  cursor: pointer;
  background: var(--color-bg-alt);
  transition: background 0.2s;
}
.endpoint-header:hover { background: var(--color-surface); }
.endpoint-method {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-mono);
  text-transform: uppercase;
}
.method-get { background: #dcfce7; color: #166534; }
.method-post { background: #dbeafe; color: #1e40af; }
.endpoint-path { font-family: var(--font-mono); font-size: 0.9rem; font-weight: 500; }
.endpoint-desc { font-size: 0.85rem; color: var(--color-text-secondary); margin-left: auto; }
.endpoint-body { padding: 20px; border-top: 1px solid var(--color-border); display: none; }
.endpoint-body.open { display: block; }

/* ---------- Table ---------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.data-table thead { background: var(--color-bg-alt); }
.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--color-text-secondary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--color-border);
}
.data-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--color-surface);
}
.data-table tr:hover td { background: var(--color-bg-alt); }
.data-table code { background: var(--color-surface); padding: 2px 6px; border-radius: 3px; font-size: 0.82rem; }

/* ---------- Team Grid ---------- */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}
.team-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
  transition: all 0.25s;
}
.team-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.team-card img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 16px;
  border: 3px solid var(--color-surface);
}
.team-card h3 { font-size: 1.05rem; margin-bottom: 4px; }
.team-card .team-role { font-size: 0.85rem; color: var(--color-primary); font-weight: 500; margin-bottom: 4px; }
.team-card .team-affiliation { font-size: 0.82rem; color: var(--color-text-secondary); margin-bottom: 12px; }
.team-card .team-desc { font-size: 0.85rem; color: var(--color-text-secondary); line-height: 1.5; }
.team-card .team-links { display: flex; justify-content: center; gap: 8px; margin-top: 12px; }
.team-card .team-links a {
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--color-text-secondary);
}
.team-card .team-links a:hover { border-color: var(--color-primary); color: var(--color-primary); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--color-text);
  color: #cbd5e1;
  padding: 60px 0 30px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}
.footer-brand { font-size: 1.1rem; font-weight: 700; color: #fff; margin-bottom: 12px; }
.footer-brand span { color: var(--color-primary); }
.footer-desc { font-size: 0.88rem; color: #94a3b8; line-height: 1.6; max-width: 320px; }
.footer-col h4 { font-size: 0.85rem; font-weight: 600; color: #fff; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 16px; }
.footer-col a { display: block; color: #94a3b8; font-size: 0.88rem; padding: 4px 0; transition: color 0.2s; }
.footer-col a:hover { color: #fff; }
.footer-bottom {
  border-top: 1px solid #334155;
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: #64748b;
}

/* ---------- Page Header (Inner pages) ---------- */
.page-header {
  padding: 120px 0 50px;
  background: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-border);
}
.page-header h1 { font-size: 2.5rem; letter-spacing: -0.02em; margin-bottom: 8px; }
.page-header p { font-size: 1.1rem; color: var(--color-text-secondary); max-width: 600px; }

/* ---------- Main Content (for markdown pages) ---------- */
.main-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: calc(var(--nav-height) + 40px) 24px 80px;
}
.main-content h1 { font-size: 2.5rem; margin-bottom: 12px; letter-spacing: -0.02em; }
.main-content h2 { font-size: 1.6rem; margin-top: 48px; margin-bottom: 16px; padding-bottom: 8px; border-bottom: 2px solid var(--color-surface); }
.main-content h3 { font-size: 1.25rem; margin-top: 32px; margin-bottom: 12px; }
.main-content p { margin-bottom: 16px; color: var(--color-text-secondary); }
.main-content ul, .main-content ol { margin-bottom: 16px; padding-left: 24px; color: var(--color-text-secondary); }
.main-content li { margin-bottom: 6px; }
.main-content img {
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

/* ---------- Demo-specific ---------- */
.demo-container { max-width: 900px; margin: 0 auto; }
.input-section {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 24px;
}
.input-section h2 { font-size: 1.3rem; margin-bottom: 20px; }
.input-section label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
  margin-top: 16px;
}
.input-section input,
.input-section textarea,
.input-section select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  transition: border-color 0.2s;
}
.input-section input:focus,
.input-section textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.submit-button {
  margin-top: 20px;
  padding: 12px 28px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-sans);
}
.submit-button:hover { background: var(--color-primary-dark); transform: translateY(-1px); }

.results-section { margin-top: 24px; }
.data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.feedback-section {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-top: 24px;
}

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}
.contact-info-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-strip { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .hero { padding: 120px 0 60px; }
  .hero h1 { font-size: 2.2rem; }
  .hero-subtitle { font-size: 1rem; }
  .features-grid { grid-template-columns: 1fr; }
  .stats-strip { grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: -24px; }
  .stat-card { padding: 16px; }
  .stat-number { font-size: 1.5rem; }
  .section { padding: 50px 0; }
  .section-header h2 { font-size: 1.6rem; }
  .page-header h1 { font-size: 1.8rem; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }
  .contact-grid { grid-template-columns: 1fr; }
  .data-grid { grid-template-columns: 1fr; }
  .team-grid { grid-template-columns: 1fr; }
}

/* ---------- Animations ---------- */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--color-bg-alt); }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ---------- Why OpenCEM Grid ---------- */
.why-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-top: 8px;
}
.why-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: box-shadow 0.3s, transform 0.3s;
}
.why-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.why-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.why-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.why-card p {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  line-height: 1.65;
  margin-bottom: 14px;
}
.why-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.why-tags span {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--color-surface);
  color: var(--color-text-secondary);
}
@media (max-width: 768px) {
  .why-grid { grid-template-columns: 1fr; }
}

/* ---------- Comparison Table ---------- */
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--color-border);
}
.comparison-table th {
  background: var(--color-bg-alt);
  padding: 12px 14px;
  text-align: center;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  border-bottom: 2px solid var(--color-border);
}
.comparison-table th:first-child { text-align: left; }
.comparison-table td {
  padding: 10px 14px;
  text-align: center;
  border-bottom: 1px solid var(--color-surface);
}
.comparison-table td:first-child { text-align: left; font-weight: 500; }
.comparison-table tr:last-child td { border-bottom: none; }
.comparison-table tr.highlight-row { background: rgba(37,99,235,0.04); }
.comparison-table tr.highlight-row td:first-child { color: var(--color-primary); font-weight: 700; }
.check { color: var(--color-accent); font-weight: 700; }
.cross { color: #ef4444; }

/* ================================================================
   DEMO PAGE — TAB BAR & SHARED
   ================================================================ */
.tab-bar {
  display: flex;
  gap: 4px;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 32px;
  overflow-x: auto;
}
.tab-btn {
  flex: 1 1 0;
  padding: 10px 16px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s, color .2s;
}
.tab-btn:hover { color: var(--color-text); }
.tab-btn.active {
  background: var(--color-bg-card);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

.demo-section-intro {
  text-align: center;
  margin-bottom: 28px;
}
.demo-section-intro h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 8px;
}
.demo-section-intro p {
  color: var(--color-text-secondary);
  font-size: 0.95rem;
  max-width: 680px;
  margin: 0 auto;
  line-height: 1.65;
}

/* ================================================================
   TAB 1 — BEFORE & AFTER COMPARISON
   ================================================================ */
.compare-scenario-picker { margin-bottom: 20px; }
.compare-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.compare-pill {
  padding: 8px 18px;
  border: 1.5px solid var(--color-border);
  border-radius: 20px;
  background: var(--color-bg-card);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all .2s;
}
.compare-pill:hover { border-color: var(--color-primary); color: var(--color-primary); }
.compare-pill.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.compare-context-banner {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
  padding: 14px 20px;
  margin-bottom: 24px;
  font-size: 0.88rem;
  color: #1e40af;
  line-height: 1.6;
}

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.compare-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.compare-card-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  padding: 4px 12px;
  border-radius: 12px;
  display: inline-block;
}
.compare-card-label.without { background: #fef2f2; color: #dc2626; }
.compare-card-label.with { background: #ecfdf5; color: #059669; }

.compare-stats {
  display: flex;
  gap: 16px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.compare-stats .cstat {
  background: var(--color-bg-alt);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 0.8rem;
}
.compare-stats .cstat strong { display: block; font-size: 1rem; color: var(--color-text); }

.compare-delta {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.compare-delta h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 12px;
}
.delta-cards { display: flex; gap: 14px; flex-wrap: wrap; }
.delta-card {
  flex: 1 1 140px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
}
.delta-card .dlabel { font-size: 0.75rem; color: var(--color-text-secondary); margin-bottom: 4px; }
.delta-card .dval { font-size: 1.15rem; font-weight: 700; }
.delta-card .dval.positive { color: #059669; }
.delta-card .dval.negative { color: #dc2626; }

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

/* ================================================================
   TAB 2 — CONTEXT IMPACT EXPLORER
   ================================================================ */
.impact-controls { margin-bottom: 24px; }
.impact-events {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.impact-event-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-card);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all .2s;
}
.impact-event-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
.impact-event-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.impact-icon { font-size: 1.05rem; }

.impact-context-card {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border: 1px solid #86efac;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 24px;
  font-size: 0.88rem;
  color: #166534;
  line-height: 1.6;
}

.impact-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.impact-chart-wrap {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.impact-chart-wrap h4 {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
}

.impact-summary {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--color-text-secondary);
}

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

/* ================================================================
   TAB 3 — SCENARIO WALKTHROUGH
   ================================================================ */
.walk-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
}
.walk-btn {
  padding: 8px 18px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-card);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: all .2s;
}
.walk-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
.walk-btn.walk-play {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.walk-btn:disabled { opacity: .4; pointer-events: none; }
.walk-time {
  font-size: 1.4rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--color-primary);
  min-width: 80px;
  text-align: center;
}

.walk-event-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 20px;
}
.walk-event-type {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-primary);
  margin-bottom: 4px;
}
.walk-event-desc {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.walk-chart-area {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 20px;
}

.walk-metrics {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.walk-metric {
  flex: 1 1 100px;
  text-align: center;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 8px;
}
.walk-metric-val {
  display: block;
  font-size: 1.2rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--color-primary);
}
.walk-metric-label {
  display: block;
  font-size: 0.72rem;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

.walk-annotation {
  font-size: 0.88rem;
  color: var(--color-text-secondary);
  line-height: 1.65;
  padding: 14px 18px;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
}
.walk-ann-tag {
  display: inline-block;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 8px;
  margin-right: 6px;
  vertical-align: middle;
}

/* ================================================================
   TAB 4 — DATA TIMELINE
   ================================================================ */
.tl-chart-area {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 24px;
}

.tl-events {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.tl-event-pin {
  padding: 7px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: 16px;
  background: var(--color-bg-card);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: all .2s;
}
.tl-event-pin:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: #eff6ff;
}
.tl-event-pin.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.tl-detail {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
}
.tl-detail-type {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-primary);
  margin-bottom: 4px;
}
.tl-detail h4 { font-size: 1rem; margin-bottom: 8px; }
.tl-detail p {
  font-size: 0.88rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
}
.tl-detail-effect {
  background: var(--color-bg-alt);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.82rem;
  color: var(--color-text-secondary);
}

/* ================================================================
   TAB 5 — CONTEXT GENERATOR (shared with inline styles)
   ================================================================ */
.ctx-step {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}
.ctx-step-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}
.ctx-step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}
.ctx-step-header h3 { font-size: 1rem; margin-bottom: 2px; }
.ctx-step-header p { font-size: 0.85rem; color: var(--color-text-secondary); margin: 0; }

.ctx-gen-tabs { display: flex; gap: 4px; }
.ctx-tab-btn {
  padding: 7px 16px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-alt);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all .2s;
}
.ctx-tab-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.ctx-input-panel {
  background: var(--color-bg-alt);
  border-radius: var(--radius-md);
  padding: 18px;
}
.ctx-input-panel label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--color-text-secondary);
}
.ctx-input-panel input[type="number"],
.ctx-input-panel input[type="date"],
.ctx-input-panel input[type="time"],
.ctx-input-panel textarea {
  width: 100%;
  padding: 10px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  background: var(--color-bg-card);
}

.ctx-record-card {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 10px;
}
.ctx-record-card label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}
.ctx-record-card input,
.ctx-record-card select,
.ctx-record-card textarea {
  width: 100%;
  padding: 8px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  background: var(--color-bg-card);
  margin-bottom: 8px;
}

.ctx-banner-inner {
  display: flex;
  align-items: center;
  gap: 10px;
}

.submit-button {
  padding: 10px 24px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
}
.submit-button:hover { opacity: .9; }

/* ================================================================
   HERO — PAPER PUNCHLINE
   ================================================================ */
.hero-citation {
  margin-top: 14px;
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}
.hero-citation em { color: var(--color-primary); font-weight: 600; }

.hero-punchline-wrapper {
  max-width: 1100px;
  margin: 0 auto;
}
.hero-punchline-img {
  width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
  background: #eff6ff;
}
.hero-punchline-photos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
.punchline-photo-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  background: var(--color-bg-card);
}
.punchline-photo-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}
.punchline-photo-card span {
  display: block;
  padding: 10px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-align: center;
}
@media (max-width: 768px) {
  .hero-punchline-photos { grid-template-columns: 1fr; }
  .punchline-photo-card img { height: 160px; }
}

/* Paper hero card */
.paper-hero-card {
  background: var(--color-bg-card);
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-lg);
  padding: 28px;
  position: relative;
  box-shadow: 0 4px 24px rgba(37,99,235,0.08);
}
.paper-hero-badge {
  position: absolute;
  top: -12px;
  left: 24px;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.paper-hero-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 4px;
  margin-bottom: 6px;
}
