/* ═══════════════════════════════════════════════════════════════════════════
   CAD 建模助手 — Design System
   Based on Anthropic Claude.com warm-cream editorial system
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ─────────────────────────────────────────────────────────── */
:root {
  /* Brand */
  --color-primary: #cc785c;
  --color-primary-active: #a9583e;
  --color-primary-disabled: #e6dfd8;

  /* Surface */
  --color-canvas: #faf9f5;
  --color-surface-soft: #f5f0e8;
  --color-surface-card: #efe9de;
  --color-surface-cream-strong: #e8e0d2;
  --color-surface-dark: #181715;
  --color-surface-dark-elevated: #252320;
  --color-surface-dark-soft: #1f1e1b;

  /* Text */
  --color-ink: #141413;
  --color-body-strong: #252523;
  --color-body: #3d3d3a;
  --color-muted: #6c6a64;
  --color-muted-soft: #8e8b82;
  --color-on-primary: #ffffff;
  --color-on-dark: #faf9f5;
  --color-on-dark-soft: #a09d96;

  /* Hairline */
  --color-hairline: #e6dfd8;
  --color-hairline-soft: #ebe6df;

  /* Semantic */
  --color-accent-teal: #5db8a6;
  --color-accent-amber: #e8a55a;
  --color-success: #5db872;
  --color-warning: #d4a017;
  --color-error: #c64545;

  /* Typography — Serif display (Cormorant Garamond as Copernicus substitute) */
  --font-display: "Cormorant Garamond", "Tiempos Headline", Garamond, "Times New Roman", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-code: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Code", monospace;

  /* Spacing (4px base) */
  --space-xxs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-xxl: 48px;
  --space-section: 96px;

  /* Border radius */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 9999px;

  /* Typography scale */
  --text-display-xl: 64px;
  --text-display-lg: 48px;
  --text-display-md: 36px;
  --text-display-sm: 28px;
  --text-title-lg: 22px;
  --text-title-md: 18px;
  --text-title-sm: 16px;
  --text-body-md: 16px;
  --text-body-sm: 14px;
  --text-caption: 13px;
  --text-caption-upper: 12px;
  --text-code: 14px;
  --text-button: 14px;
  --text-nav: 14px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-body-md);
  font-weight: 400;
  line-height: 1.55;
  color: var(--color-body);
  background: var(--color-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Screen reader only ── */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── Focus ring ── */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── Utility ── */
.hidden { display: none !important; }

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-xs);
  font-family: var(--font-body); font-size: var(--text-button); font-weight: 500;
  line-height: 1; text-decoration: none;
  padding: 12px 20px; height: 40px;
  border: none; border-radius: var(--radius-md);
  cursor: pointer; transition: background-color 0.15s ease;
  user-select: none; white-space: nowrap;
}

.btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.btn-primary {
  background: var(--color-primary); color: var(--color-on-primary);
}
.btn-primary:hover { background: var(--color-primary-active); }
.btn-primary:active { background: var(--color-primary-active); }
.btn-primary:disabled {
  background: var(--color-primary-disabled); color: var(--color-muted);
  cursor: not-allowed;
}

.btn-large {
  padding: 14px 28px; height: 48px; font-size: 16px;
}

.btn-secondary {
  background: var(--color-canvas); color: var(--color-ink);
  border: 1px solid var(--color-hairline);
}
.btn-secondary:hover { border-color: var(--color-muted); }
.btn-secondary:active { background: var(--color-surface-soft); }

.btn-secondary-on-dark {
  background: var(--color-surface-dark-elevated); color: var(--color-on-dark);
  border: 1px solid rgba(255,255,255,0.08);
}
.btn-secondary-on-dark:hover { background: rgba(255,255,255,0.08); }

.btn-text-link {
  background: transparent; color: var(--color-ink);
  padding: 4px 8px; height: auto;
}
.btn-text-link:hover { color: var(--color-primary); }

.btn-icon-circular {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-pill);
  background: var(--color-canvas); color: var(--color-ink);
  border: 1px solid var(--color-hairline); cursor: pointer;
  font-size: 16px; padding: 0;
}
.btn-icon-circular:hover { background: var(--color-surface-soft); }

/* ═══════════════════════════════════════════════════════════════════════════
   TOP NAVIGATION
   ═══════════════════════════════════════════════════════════════════════════ */
.top-nav {
  position: sticky; top: 0; z-index: 100;
  height: 64px; background: var(--color-canvas);
  border-bottom: 1px solid var(--color-hairline);
}
.nav-inner {
  max-width: 1200px; height: 100%; margin: 0 auto;
  padding: 0 var(--space-xl);
  display: flex; align-items: center; justify-content: space-between;
}
.nav-brand {
  display: flex; align-items: center; gap: var(--space-sm);
  text-decoration: none; color: var(--color-ink);
}
.brand-mark {
  font-family: var(--font-display); font-size: 24px; color: var(--color-primary);
  line-height: 1;
}
.brand-text {
  font-family: var(--font-display); font-size: 20px; font-weight: 500;
  color: var(--color-ink); letter-spacing: -0.3px;
}
.nav-right { display: flex; align-items: center; gap: var(--space-md); }
.nav-model-badge {
  font-family: var(--font-body); font-size: var(--text-caption); font-weight: 500;
  color: var(--color-muted); padding: 4px 12px;
  background: var(--color-surface-card); border-radius: var(--radius-pill);
}

/* ═══════════════════════════════════════════════════════════════════════════
   HERO BAND
   ═══════════════════════════════════════════════════════════════════════════ */
.hero-band {
  background: var(--color-canvas);
  padding: var(--space-section) var(--space-xl);
}
.hero-inner {
  max-width: 1200px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: var(--space-xxl); align-items: center;
}

.hero-headline {
  font-family: var(--font-display); font-size: var(--text-display-xl);
  font-weight: 400; line-height: 1.05; letter-spacing: -1.5px;
  color: var(--color-ink); margin-bottom: var(--space-lg);
}
.hero-subhead {
  font-family: var(--font-body); font-size: var(--text-body-md);
  font-weight: 400; line-height: 1.55;
  color: var(--color-body); max-width: 520px;
  margin-bottom: var(--space-xl);
}

.hero-input-group { display: flex; flex-direction: column; gap: var(--space-md); }

.text-input {
  font-family: var(--font-body); font-size: var(--text-body-md);
  color: var(--color-ink); background: var(--color-canvas);
  border: 1px solid var(--color-hairline); border-radius: var(--radius-md);
  padding: 10px 14px; transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.text-input:focus {
  outline: none; border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(204,120,92,0.15);
}
.text-input::placeholder { color: var(--color-muted-soft); }

.hero-textarea {
  resize: vertical; min-height: 120px; line-height: 1.6;
  padding: var(--space-md);
}

.hero-actions {
  display: flex; align-items: center; gap: var(--space-md);
}
.hero-hint {
  font-size: var(--text-caption); color: var(--color-muted);
}

.hero-examples {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs);
  padding-top: var(--space-xs);
}
.examples-label {
  font-size: var(--text-caption); color: var(--color-muted-soft);
  margin-right: var(--space-xxs);
}

/* ── Chip (badge-pill / category-tab hybrid) ── */
.chip {
  font-family: var(--font-body); font-size: var(--text-caption); font-weight: 500;
  color: var(--color-muted); background: transparent;
  border: 1px solid var(--color-hairline); border-radius: var(--radius-pill);
  padding: 4px 14px; cursor: pointer;
  transition: all 0.15s ease; line-height: 1.4;
}
.chip:hover { background: var(--color-surface-card); color: var(--color-ink); }
.chip:active { background: var(--color-surface-cream-strong); }

/* ── Hero illustration card ── */
.hero-illustration {
  display: flex; justify-content: center; align-items: center;
}
.illustration-card {
  background: var(--color-surface-card);
  border-radius: var(--radius-xl);
  padding: var(--space-xxl);
  width: 100%; max-width: 440px;
  aspect-ratio: 1 / 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--space-lg);
}
.illustration-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-xs);
  width: 180px;
}
.grid-cell {
  aspect-ratio: 1; border-radius: var(--radius-xs);
  background: var(--color-surface-cream-strong);
  transition: background 0.3s ease;
}
.grid-cell.highlight { background: var(--color-primary); }
.illustration-label {
  font-family: var(--font-body); font-size: var(--text-caption-upper);
  font-weight: 500; letter-spacing: 1.5px;
  color: var(--color-muted-soft); text-transform: uppercase;
}

/* ═══════════════════════════════════════════════════════════════════════════
   STATUS BAND
   ═══════════════════════════════════════════════════════════════════════════ */
.status-band {
  background: var(--color-surface-soft);
  border-top: 1px solid var(--color-hairline-soft);
  border-bottom: 1px solid var(--color-hairline-soft);
}
.band-inner {
  max-width: 1200px; margin: 0 auto;
  padding: var(--space-lg) var(--space-xl);
}
.status-card {
  display: flex; flex-direction: column; gap: var(--space-sm);
  padding: var(--space-lg);
  background: var(--color-surface-card);
  border-radius: var(--radius-lg);
}
.status-indicator {
  display: flex; align-items: center; gap: var(--space-sm);
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--color-accent-amber);
  animation: pulse-dot 1.2s ease infinite;
}
.status-dot-done { background: var(--color-success); animation: none; }
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}
.status-label {
  font-family: var(--font-body); font-size: var(--text-body-sm); font-weight: 500;
  color: var(--color-body-strong);
}
.progress-track {
  height: 4px; border-radius: 2px; background: var(--color-hairline);
  overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0; border-radius: 2px;
  background: var(--color-primary);
  transition: width 0.6s ease;
}
.status-prompt-text {
  font-size: var(--text-caption); color: var(--color-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ERROR BAND
   ═══════════════════════════════════════════════════════════════════════════ */
.error-band {
  background: var(--color-surface-soft);
  border-top: 1px solid var(--color-hairline-soft);
  border-bottom: 1px solid var(--color-hairline-soft);
}
.error-card {
  padding: var(--space-lg);
  background: var(--color-canvas);
  border: 1px solid rgba(198,69,69,0.25);
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column; gap: var(--space-sm);
}
.error-head {
  display: flex; align-items: center; gap: var(--space-xs);
  font-family: var(--font-body); font-size: var(--text-title-sm); font-weight: 500;
  color: var(--color-error);
}
.error-body {
  font-family: var(--font-code); font-size: var(--text-code);
  color: var(--color-body); line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
  max-height: 240px; overflow-y: auto;
  padding: var(--space-md);
  background: var(--color-surface-soft);
  border-radius: var(--radius-sm);
}
.error-card .btn-text-link { align-self: flex-start; }

/* ═══════════════════════════════════════════════════════════════════════════
   VIEWER BAND — Dark product surface
   ═══════════════════════════════════════════════════════════════════════════ */
.viewer-band {
  background: var(--color-surface-dark);
  padding: var(--space-section) var(--space-xl);
}
.section-title-dark {
  font-family: var(--font-display); font-size: var(--text-display-sm);
  font-weight: 400; line-height: 1.2; letter-spacing: -0.3px;
  color: var(--color-on-dark);
}
.viewer-head {
  max-width: 1200px; margin: 0 auto var(--space-xl);
  display: flex; align-items: center; justify-content: space-between;
}
.viewer-actions { display: flex; align-items: center; gap: var(--space-sm); }
.dl-label {
  font-size: var(--text-caption); color: var(--color-on-dark-soft);
  margin-right: var(--space-xxs);
}
.viewer-card { max-width: 1200px; margin: 0 auto; }

/* ── Code Window Card ── */
.code-window-card {
  background: var(--color-surface-dark);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
}
.code-window-chrome {
  display: flex; align-items: center; gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-surface-dark-elevated);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.chrome-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.chrome-dot-red { background: #c64545; }
.chrome-dot-amber { background: #d4a017; }
.chrome-dot-green { background: #5db872; }
.chrome-title {
  margin-left: var(--space-sm);
  font-family: var(--font-code); font-size: var(--text-caption);
  color: var(--color-on-dark-soft);
}

.viewer-stage {
  position: relative; width: 100%; aspect-ratio: 16 / 10;
  min-height: 480px; background: var(--color-surface-dark-soft);
}
.viewer-placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--space-sm); pointer-events: none;
}
.placeholder-icon {
  font-family: var(--font-display); font-size: 56px;
  color: rgba(250,249,245,0.12); line-height: 1;
}
.placeholder-title {
  font-family: var(--font-display); font-size: var(--text-display-sm);
  color: rgba(250,249,245,0.2); letter-spacing: -0.3px;
}
.placeholder-desc {
  font-size: var(--text-body-sm); color: rgba(250,249,245,0.12);
}
.viewer-frame {
  position: absolute; inset: 0; width: 100%; height: 100%; border: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CODE BAND
   ═══════════════════════════════════════════════════════════════════════════ */
.code-band {
  background: var(--color-canvas);
  padding: var(--space-section) var(--space-xl);
}
.code-band-head {
  max-width: 1200px; margin: 0 auto var(--space-lg);
  display: flex; align-items: center; justify-content: space-between;
}
.section-title {
  font-family: var(--font-display); font-size: var(--text-display-sm);
  font-weight: 400; line-height: 1.2; letter-spacing: -0.3px;
  color: var(--color-ink);
}
.code-display-card {
  max-width: 1200px; margin: 0 auto;
  background: var(--color-surface-dark);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(0,0,0,0.08);
  overflow: hidden;
}
.code-display-card .code-window-chrome {
  background: var(--color-surface-dark-elevated);
}
.code-body {
  padding: var(--space-lg);
  margin: 0;
  font-family: var(--font-code); font-size: var(--text-code);
  font-weight: 400; line-height: 1.6;
  color: var(--color-on-dark);
  background: var(--color-surface-dark-soft);
  overflow-x: auto; max-height: 480px; overflow-y: auto;
  white-space: pre;
  tab-size: 4; -moz-tab-size: 4;
}
.code-body.collapsed { max-height: 0; padding: 0; overflow: hidden; }

/* ═══════════════════════════════════════════════════════════════════════════
   HISTORY BAND
   ═══════════════════════════════════════════════════════════════════════════ */
.history-band {
  background: var(--color-surface-soft);
  padding: var(--space-section) var(--space-xl);
}
.history-head {
  max-width: 1200px; margin: 0 auto var(--space-lg);
  display: flex; align-items: center; justify-content: space-between;
}

.connector-grid {
  max-width: 1200px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}
.history-empty {
  grid-column: 1 / -1;
  text-align: center; padding: var(--space-xxl) 0;
  font-size: var(--text-body-sm); color: var(--color-muted);
}

/* ── Connector Tile ── */
.history-tile {
  background: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  display: flex; flex-direction: column; gap: var(--space-sm);
}
.history-tile:hover {
  border-color: var(--color-primary);
  background: var(--color-canvas);
}
.history-tile.active {
  border-color: var(--color-primary);
  background: rgba(204,120,92,0.05);
}
.tile-status {
  display: flex; align-items: center; gap: var(--space-xs);
}
.tile-dot {
  width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
}
.tile-dot-done { background: var(--color-success); }
.tile-dot-error { background: var(--color-error); }
.tile-dot-running { background: var(--color-accent-amber); animation: pulse-dot 1.2s ease infinite; }
.tile-status-label {
  font-size: var(--text-caption); font-weight: 500;
  color: var(--color-muted);
}
.tile-prompt {
  font-family: var(--font-body); font-size: var(--text-body-sm);
  color: var(--color-body-strong); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.tile-time {
  font-size: var(--text-caption); color: var(--color-muted-soft);
}

/* ═══════════════════════════════════════════════════════════════════════════
   CTA BAND — Coral full-bleed
   ═══════════════════════════════════════════════════════════════════════════ */
.cta-band-coral {
  background: var(--color-primary); color: var(--color-on-primary);
  padding: 64px var(--space-xl); text-align: center;
}
.cta-inner {
  max-width: 720px; margin: 0 auto;
  display: flex; flex-direction: column; align-items: center; gap: var(--space-lg);
}
.cta-headline {
  font-family: var(--font-display); font-size: var(--text-display-sm);
  font-weight: 400; line-height: 1.2; letter-spacing: -0.3px;
  color: var(--color-on-primary);
}
.cta-subhead {
  font-size: var(--text-body-md); color: rgba(255,255,255,0.85);
  line-height: 1.55; max-width: 520px;
}
.cta-band-coral .btn-secondary {
  background: var(--color-canvas); color: var(--color-ink);
  border-color: transparent;
}
.cta-band-coral .btn-secondary:hover { background: white; }

/* ═══════════════════════════════════════════════════════════════════════════
   FOOTER — Dark navy
   ═══════════════════════════════════════════════════════════════════════════ */
.footer {
  background: var(--color-surface-dark); color: var(--color-on-dark-soft);
  padding: 64px var(--space-xl);
}
.footer-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; flex-direction: column; gap: var(--space-lg);
}
.footer-brand {
  display: flex; align-items: center; gap: var(--space-sm);
  font-family: var(--font-display); font-size: 18px;
  color: var(--color-on-dark);
}
.footer-links {
  display: flex; gap: var(--space-xxl);
}
.footer-col {
  display: flex; flex-direction: column; gap: var(--space-xs);
  font-size: var(--text-body-sm);
}
.footer-col-title {
  font-weight: 500; color: var(--color-on-dark);
  margin-bottom: var(--space-xxs);
}
.footer-copy {
  font-size: var(--text-caption); color: var(--color-on-dark-soft);
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: var(--space-lg);
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

/* Tablet: 768–1024px */
@media (max-width: 1024px) {
  :root {
    --text-display-xl: 48px;
    --text-display-sm: 24px;
    --space-section: 64px;
  }
  .hero-inner {
    grid-template-columns: 1fr; gap: var(--space-xl);
  }
  .hero-illustration { display: none; }
  .connector-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Mobile: < 768px */
@media (max-width: 768px) {
  :root {
    --text-display-xl: 36px;
    --text-display-sm: 22px;
    --space-section: 48px;
    --space-xl: 24px;
  }
  .nav-brand .brand-text { display: none; }
  .nav-model-badge { display: none; }
  .hero-band { padding: var(--space-xxl) var(--space-md); }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-subhead { font-size: var(--text-body-sm); }
  .connector-grid { grid-template-columns: 1fr; }
  .viewer-stage { min-height: 320px; }
  .code-body { max-height: 320px; }
  .footer-links { flex-direction: column; gap: var(--space-lg); }
  .viewer-head { flex-direction: column; gap: var(--space-md); align-items: flex-start; }
  .code-band-head { flex-direction: column; gap: var(--space-sm); align-items: flex-start; }
  .cta-band-coral { padding: var(--space-xxl) var(--space-md); }
}

/* Wide: > 1440px — max-width cap already enforced at 1200px */
