/* ============================================================
   CUPR / CourtOS — Shared Design System
   Investor-grade, minimal, lots of whitespace
   ============================================================ */

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

:root {
  /* Typography */
  --font: 'Inter', -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;

  /* Spacing scale (8px base) */
  --s1: 8px;  --s2: 16px; --s3: 24px; --s4: 32px;
  --s5: 40px; --s6: 48px; --s8: 64px; --s10: 80px;
  --s12: 96px; --s16: 128px;

  /* Layout */
  --container: 1100px;
  --radius: 14px;
  --radius-lg: 22px;

  /* Theme colors — overridden per site via <style> in HTML */
  --primary: #00A676;
  --primary-dark: #008060;
  --primary-light: #E6F7F2;
  --accent: #FFB800;
  --bg: #FAFBFD;
  --surface: #FFFFFF;
  --ink: #111827;
  --ink-secondary: #64748B;
  --ink-muted: #94A3B8;
  --border: #E5E7EB;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.08);

  /* Transitions */
  --ease: cubic-bezier(.4,0,.2,1);
}

html { font-size: 16px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.7;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: 1rem; }

/* --- Container --- */
.container { max-width: var(--container); margin: 0 auto; padding: 0 var(--s3); }

/* --- Typography --- */
h1 { font-size: clamp(2rem, 5vw, 3.25rem); font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); font-weight: 700; line-height: 1.2; letter-spacing: -0.015em; }
h3 { font-size: clamp(1.125rem, 2vw, 1.375rem); font-weight: 600; line-height: 1.35; }
.text-secondary { color: var(--ink-secondary); }
.text-muted { color: var(--ink-muted); }
.text-small { font-size: 0.875rem; }
.text-center { text-align: center; }

/* --- Header --- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  height: 64px;
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between; height: 100%;
}
.logo {
  font-size: 1.35rem; font-weight: 800; letter-spacing: -0.03em;
  color: var(--primary-dark);
}
.logo span { color: var(--ink-muted); font-weight: 400; font-size: 0.8rem; margin-left: var(--s1); }

.header-nav { display: flex; align-items: center; gap: var(--s4); }
.header-nav a {
  font-size: 0.9rem; font-weight: 500; color: var(--ink-secondary);
  transition: color .2s var(--ease);
}
.header-nav a:hover { color: var(--ink); }

.header-actions { display: flex; align-items: center; gap: var(--s2); }

.lang-toggle {
  font-size: 0.8rem; font-weight: 600;
  padding: 5px 12px; border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--ink-secondary);
  transition: all .2s var(--ease);
  background: var(--surface);
}
.lang-toggle:hover { border-color: var(--primary); color: var(--primary); }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.9rem; font-weight: 600;
  padding: 12px 28px; border-radius: 10px;
  transition: all .25s var(--ease);
  white-space: nowrap;
}
.btn-primary {
  background: var(--primary); color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}
.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
}
.btn-secondary {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  border-color: var(--primary); color: var(--primary);
  transform: translateY(-1px);
}
.btn-sm { padding: 8px 20px; font-size: 0.85rem; border-radius: 8px; }
.btn-lg { padding: 16px 36px; font-size: 1rem; border-radius: 12px; }

/* --- Sections --- */
section { padding: var(--s12) 0; }
section.hero { padding: var(--s16) 0 var(--s12); }
section.dark {
  background: var(--ink);
  color: #fff;
}
section.dark .text-secondary,
section.dark .text-muted { color: rgba(255,255,255,.6); }
section.tinted { background: var(--primary-light); }

.section-label {
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--primary);
  margin-bottom: var(--s2);
}
.section-head {
  max-width: 680px; margin: 0 auto var(--s8);
}
.section-head p { margin-top: var(--s2); color: var(--ink-secondary); font-size: 1.05rem; }

/* --- Hero --- */
.hero-content { max-width: 720px; }
.hero-content h1 { margin-bottom: var(--s3); }
.hero-subhead {
  font-size: 1.15rem; color: var(--ink-secondary);
  margin-bottom: var(--s2); font-weight: 500;
  letter-spacing: 0.04em;
}
.hero-note {
  font-size: 0.875rem; color: var(--ink-muted);
  margin-bottom: var(--s5);
}
.hero-actions { display: flex; gap: var(--s2); flex-wrap: wrap; }

/* Hero decorative element */
.hero-decoration {
  position: absolute; right: -60px; top: 50%; transform: translateY(-50%);
  width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle at 30% 40%, var(--primary-light) 0%, transparent 70%);
  opacity: 0.5; pointer-events: none;
}

/* --- Cards --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s3);
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s5) var(--s4);
  transition: all .3s var(--ease);
}
.card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--s3);
  color: var(--primary);
}
.card-icon svg { width: 24px; height: 24px; }
.card h3 { margin-bottom: var(--s1); }
.card p { color: var(--ink-secondary); font-size: 0.925rem; line-height: 1.65; }

/* --- Ecosystem Diagram --- */
.ecosystem {
  position: relative;
  width: 100%; max-width: 500px; margin: 0 auto;
  aspect-ratio: 1;
}
.eco-center {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 140px; height: 140px; border-radius: 50%;
  background: var(--primary);
  color: #fff; font-weight: 700; font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  text-align: center; line-height: 1.3;
  box-shadow: 0 4px 24px rgba(0,166,118,.3);
  z-index: 2;
}
.eco-node {
  position: absolute;
  width: 100px; height: 100px; border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 600; color: var(--ink);
  z-index: 2;
  transition: all .3s var(--ease);
}
.eco-node:hover { border-color: var(--primary); transform: scale(1.06); }
.eco-node.top { top: 4%; left: 50%; transform: translateX(-50%); }
.eco-node.bottom-left { bottom: 8%; left: 10%; }
.eco-node.bottom-right { bottom: 8%; right: 10%; }
.eco-node.top:hover { transform: translateX(-50%) scale(1.06); }

/* Connecting lines (CSS pseudo) */
.eco-lines {
  position: absolute; inset: 0; z-index: 1;
}
.eco-lines svg { width: 100%; height: 100%; }
.eco-lines line {
  stroke: var(--border); stroke-width: 1.5;
  stroke-dasharray: 6 4;
}

/* --- Content Sections (text pages) --- */
.content-section { max-width: 680px; margin: 0 auto; }
.content-section h2 { margin-bottom: var(--s4); }
.content-section p { margin-bottom: var(--s3); color: var(--ink-secondary); font-size: 1.05rem; }
.content-section ul { padding-left: var(--s3); margin-bottom: var(--s3); }
.content-section li {
  color: var(--ink-secondary); font-size: 1rem;
  margin-bottom: var(--s1); padding-left: var(--s1);
}
.content-section li::marker { color: var(--primary); }

.callout {
  background: var(--primary-light);
  border-left: 3px solid var(--primary);
  padding: var(--s3) var(--s4);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--primary-dark);
  font-weight: 500; font-size: 0.95rem;
  margin: var(--s5) 0;
}

/* --- Bullets list (styled) --- */
.check-list { list-style: none; padding: 0; }
.check-list li {
  padding: var(--s1) 0 var(--s1) var(--s4);
  position: relative; color: var(--ink);
}
.check-list li::before {
  content: '';
  position: absolute; left: 0; top: 14px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--primary-light);
  border: 2px solid var(--primary);
}

/* --- CTA Section --- */
.cta-section {
  text-align: center;
  padding: var(--s10) var(--s3);
  background: var(--primary-light);
  border-radius: var(--radius-lg);
  margin: var(--s8) auto;
  max-width: var(--container);
}
.cta-section h2 { margin-bottom: var(--s2); }
.cta-section p { color: var(--ink-secondary); margin-bottom: var(--s5); max-width: 520px; margin-left: auto; margin-right: auto; }

/* --- Form (inline) --- */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--s6);
  max-width: 520px;
  margin: 0 auto;
  box-shadow: var(--shadow-md);
}
.form-card h3 { margin-bottom: var(--s3); }
.form-group { margin-bottom: var(--s3); }
.form-group label {
  display: block; font-size: 0.875rem; font-weight: 600;
  margin-bottom: 6px; color: var(--ink);
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%; padding: 11px 14px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg);
  transition: border-color .2s var(--ease);
  color: var(--ink);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,166,118,.1);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-note { font-size: 0.8rem; color: var(--ink-muted); margin-top: var(--s2); }

/* --- Modal --- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.4); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .25s var(--ease);
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-body {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: var(--s6); max-width: 480px; width: 92%;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform .3s var(--ease);
}
.modal-overlay.active .modal-body { transform: translateY(0); }
.modal-close {
  float: right; font-size: 1.25rem; color: var(--ink-muted);
  padding: var(--s1); margin: calc(var(--s1) * -1);
}
.modal-close:hover { color: var(--ink); }

/* Success state */
.form-success {
  text-align: center; padding: var(--s5) 0;
}
.form-success .check-circle {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto var(--s3);
  font-size: 1.5rem;
}
.form-success h3 { margin-bottom: var(--s1); }
.form-success p { color: var(--ink-secondary); }

.hidden { display: none !important; }

/* --- Footer --- */
.site-footer {
  padding: var(--s6) 0;
  border-top: 1px solid var(--border);
  margin-top: var(--s8);
}
.site-footer .container {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: var(--s2);
}
.footer-copy { font-size: 0.8rem; color: var(--ink-muted); }
.footer-links { display: flex; gap: var(--s3); }
.footer-links a {
  font-size: 0.8rem; color: var(--ink-muted);
  transition: color .2s var(--ease);
}
.footer-links a:hover { color: var(--ink); }

/* --- Legal Pages --- */
.legal-wrap {
  max-width: 740px; margin: 0 auto;
  padding: var(--s8) var(--s3);
}
.legal-wrap h1 { font-size: 1.75rem; margin-bottom: var(--s6); }
.legal-wrap h2 { font-size: 1.15rem; margin-top: var(--s5); margin-bottom: var(--s2); color: var(--ink); }
.legal-wrap p { color: var(--ink-secondary); margin-bottom: var(--s2); font-size: 0.95rem; }

/* --- Noindex banner (hidden pages) --- */
.noindex-banner {
  background: #FEF3C7; border-bottom: 1px solid #F59E0B;
  padding: var(--s1) var(--s3);
  font-size: 0.8rem; color: #92400E; text-align: center; font-weight: 500;
}

/* --- Geometric decorations --- */
.geo-dot-grid {
  position: absolute; opacity: 0.06; pointer-events: none;
  background-image: radial-gradient(circle, var(--ink) 1px, transparent 1px);
  background-size: 24px 24px;
}
.geo-gradient-orb {
  position: absolute; border-radius: 50%; pointer-events: none; opacity: 0.12;
  filter: blur(60px);
}

/* --- Hero Split (text + image) --- */
.hero-split {
  display: flex; align-items: center; gap: var(--s8);
}
.hero-split .hero-content { flex: 1; min-width: 0; }
.hero-visual {
  flex: 1; min-width: 0;
  display: flex; align-items: center; justify-content: center;
}
.hero-img {
  width: 100%; max-width: 560px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

/* --- Feature Rows (alternating text + image) --- */
.feature-row {
  display: flex; align-items: center; gap: var(--s8);
  margin-bottom: var(--s10);
}
.feature-row:last-child { margin-bottom: 0; }
.feature-row .feature-text { flex: 1; min-width: 0; }
.feature-row .feature-text h3 { font-size: clamp(1.25rem, 2.5vw, 1.75rem); margin-bottom: var(--s2); }
.feature-row .feature-text p { color: var(--ink-secondary); font-size: 1rem; margin-bottom: var(--s2); line-height: 1.7; }
.feature-img-wrap {
  flex: 1; min-width: 0;
  display: flex; align-items: center; justify-content: center;
}
.feature-img {
  width: 100%; max-width: 520px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.feature-img:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.feature-row.reverse { flex-direction: row-reverse; }

/* --- Feature Showcase (full-width image) --- */
.feature-showcase {
  text-align: center;
}
.showcase-img {
  width: 100%; max-width: 900px;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

/* --- Divider --- */
.divider { border: none; border-top: 1px solid var(--border); margin: var(--s8) 0; }

/* --- Integration highlight --- */
.integration-highlight {
  display: flex; align-items: center; gap: var(--s5);
  padding: var(--s6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.integration-highlight .int-text { flex: 1; }
.integration-highlight .int-text p { color: var(--ink-secondary); margin: var(--s2) 0 var(--s3); }
.integration-highlight .int-visual {
  width: 180px; height: 180px; border-radius: 50%;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-weight: 700; color: var(--primary); font-size: 1.1rem;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .card-grid { grid-template-columns: 1fr; gap: var(--s2); }
  section { padding: var(--s8) 0; }
  section.hero { padding: var(--s10) 0 var(--s8); }
  .hero-decoration { display: none; }
  .header-nav { display: none; }
  .hero-split { flex-direction: column; gap: var(--s5); }
  .hero-visual { order: -1; }
  .hero-img { max-width: 100%; }
  .feature-row, .feature-row.reverse { flex-direction: column; gap: var(--s4); }
  .feature-img { max-width: 100%; }
  .integration-highlight { flex-direction: column; text-align: center; }
  .integration-highlight .int-visual { width: 140px; height: 140px; }
  .eco-center { width: 110px; height: 110px; font-size: 0.75rem; }
  .eco-node { width: 80px; height: 80px; font-size: 0.75rem; }
}

@media (max-width: 600px) {
  .site-header { height: 56px; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; }
  .form-card { padding: var(--s4); }
  .cta-section { padding: var(--s6) var(--s3); border-radius: var(--radius); }
  .site-footer .container { flex-direction: column; text-align: center; }
}

/* --- Fade-in animation --- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in {
  opacity: 0; animation: fadeUp .6s var(--ease) forwards;
}
.fade-in.d1 { animation-delay: .1s; }
.fade-in.d2 { animation-delay: .2s; }
.fade-in.d3 { animation-delay: .3s; }
.fade-in.d4 { animation-delay: .4s; }
