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

/* ─── Design Tokens ─────────────────────────────────────────────────── */
:root {
  --bg-base:       #0d0d1a;
  --bg-surface:    rgba(255, 255, 255, 0.04);
  --bg-elevated:   rgba(255, 255, 255, 0.07);
  --bg-hover:      rgba(255, 255, 255, 0.10);

  --border:        rgba(255, 255, 255, 0.10);
  --border-active: rgba(138, 92, 246, 0.60);

  --accent:        #8a5cf6;
  --accent-light:  #a78bfa;
  --accent-glow:   rgba(138, 92, 246, 0.25);
  --accent2:       #ec4899;
  --accent2-glow:  rgba(236, 72, 153, 0.20);

  --text-primary:   #f1f0ff;
  --text-secondary: #a0a0c0;
  --text-muted:     #5a5a7a;

  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  18px;
  --radius-xl:  24px;

  --shadow-sm:  0 2px 8px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 20px rgba(0,0,0,0.5);
  --shadow-lg:  0 8px 40px rgba(0,0,0,0.6);

  --transition: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Subtle animated gradient background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(138, 92, 246, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 90%, rgba(236, 72, 153, 0.10) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(59, 130, 246, 0.06) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

a { color: var(--accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

/* ─── Layout ────────────────────────────────────────────────────────── */
.page-wrapper {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ─── Header ────────────────────────────────────────────────────────── */
.site-header {
  padding: 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

/* ── Inline SVG logo icon ── */
.logo-icon-svg {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px rgba(124, 58, 237, 0.5));
  transition: transform var(--transition), filter var(--transition);
}

.logo:hover .logo-icon-svg {
  transform: scale(1.08);
  filter: drop-shadow(0 4px 16px rgba(124, 58, 237, 0.75));
}

/* Text group next to the icon */
.logo-text-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1;
}

.logo-name {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #fff 0%, var(--accent-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-sub {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--accent-light);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.8;
}

.header-tagline {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ─── Hero Section ──────────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 52px 0 40px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-active);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent-light);
  margin-bottom: 20px;
  letter-spacing: 0.02em;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #fff 0%, var(--accent-light) 60%, var(--accent2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.03em;
}

.hero p {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ─── App Container ─────────────────────────────────────────────────── */
.app-container {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  margin: 0 0 32px;
  align-items: start;
}

/* ─── Canvas Panel ──────────────────────────────────────────────────── */
.canvas-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  position: sticky;
  top: 20px;
}

.canvas-wrapper {
  position: relative;
  width: 280px;
  height: 280px;
}

#avatar-canvas {
  width: 280px;
  height: 280px;
  border-radius: var(--radius-lg);
  display: block;
  box-shadow: 0 0 0 1px var(--border), var(--shadow-lg);
  transition: box-shadow var(--transition);
}

#avatar-canvas:hover {
  box-shadow: 0 0 0 2px var(--border-active), 0 0 40px var(--accent-glow), var(--shadow-lg);
}

.canvas-shine {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(255,255,255,0.04) 0%, transparent 50%);
  pointer-events: none;
}

/* Canvas action buttons */
.canvas-actions {
  display: flex;
  gap: 10px;
  width: 100%;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  padding: 10px 16px;
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  flex: 1;
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: rgba(255,255,255,0.2);
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  flex: 1;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
  filter: brightness(1.12);
  transform: translateY(-2px);
  box-shadow: 0 6px 25px var(--accent-glow);
}

.btn-icon { font-size: 1rem; }

/* Spin animation for randomize */
.spin .btn-icon { animation: spin 0.4s ease-out; }
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Pulse on download */
.pulse { animation: pulse 0.6s ease-out; }
@keyframes pulse {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* Export row */
.export-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.export-row label {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.select-styled {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 8px 12px;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a5cf6' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.select-styled:focus {
  border-color: var(--accent);
}

/* Background colors */
.bg-section {
  width: 100%;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.bg-colors-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bg-swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  padding: 0;
}

.bg-swatch:hover { transform: scale(1.15); }
.bg-swatch.selected {
  border-color: var(--accent-light);
  box-shadow: 0 0 0 2px var(--accent-glow), 0 0 10px var(--accent-glow);
}

/* ─── Controls Panel ────────────────────────────────────────────────── */
.controls-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(12px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Category Tabs — 5×2 grid, all 10 visible at once */
.category-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  padding: 10px;
  border-bottom: 1px solid var(--border);
}

.cat-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 7px 4px;
  background: var(--bg-elevated);
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
  min-width: 0; /* allow shrinking inside grid */
}

.cat-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.cat-tab.active {
  color: var(--accent-light);
  background: rgba(138, 92, 246, 0.14);
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

.cat-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.cat-name {
  font-size: 0.62rem;
  letter-spacing: 0.01em;
}

/* Parts Grid */
.parts-section {
  padding: 16px;
}

.parts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.parts-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.active-part-badge {
  font-size: 0.75rem;
  color: var(--accent-light);
  background: var(--accent-glow);
  border: 1px solid var(--border-active);
  border-radius: 999px;
  padding: 2px 10px;
}

.parts-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.parts-grid::-webkit-scrollbar { width: 4px; }
.parts-grid::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.parts-grid.fade-in {
  animation: fadeInUp 0.22s ease-out;
}

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

.part-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-elevated);
}

.part-item:hover {
  background: var(--bg-hover);
  border-color: rgba(255,255,255,0.12);
  transform: translateY(-2px);
}

.part-item.selected {
  border-color: var(--accent);
  background: rgba(138, 92, 246, 0.12);
  box-shadow: 0 0 12px var(--accent-glow);
}

.part-preview {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  display: block;
}

.part-label {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.2;
}

.part-item.selected .part-label {
  color: var(--accent-light);
}

/* Color Section */
.color-section {
  padding: 0 16px 16px;
  border-top: 1px solid var(--border);
}

.color-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 10px;
}

#color-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.color-slots {
  display: flex;
  gap: 6px;
}

.color-slot-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--slot-color, #ccc);
  cursor: pointer;
  padding: 0;
  transition: all var(--transition);
  position: relative;
}

.color-slot-btn::after {
  content: attr(data-label);
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  color: var(--text-muted);
  white-space: nowrap;
  opacity: 0;
  transition: opacity var(--transition);
}

.color-slot-btn:hover::after { opacity: 1; }
.color-slot-btn.active {
  border-color: var(--accent-light);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: all var(--transition);
}

.color-swatch:hover { transform: scale(1.2); }
.color-swatch.selected {
  border-color: var(--accent-light);
  box-shadow: 0 0 0 2px var(--accent-glow);
  transform: scale(1.1);
}

.hex-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hex-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.hex-input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Inter', monospace;
  font-size: 0.82rem;
  padding: 6px 10px;
  outline: none;
  transition: border-color var(--transition);
}

.hex-input:focus {
  border-color: var(--accent);
}

/* ─── Feature Strip ─────────────────────────────────────────────────── */
.features-strip {
  display: flex;
  gap: 12px;
  margin: 0 0 60px;
  flex-wrap: wrap;
}

.feature-card {
  flex: 1;
  min-width: 200px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: blur(8px);
  transition: all var(--transition);
}

.feature-card:hover {
  border-color: var(--border-active);
  background: var(--bg-elevated);
  transform: translateY(-3px);
  box-shadow: 0 8px 30px var(--accent-glow);
}

.feature-icon {
  font-size: 1.8rem;
  margin-bottom: 10px;
  display: block;
}

.feature-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.feature-card p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ─── How To Section ────────────────────────────────────────────────── */
.section {
  margin: 0 0 60px;
}

.section-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-subtitle {
  color: var(--text-secondary);
  margin-bottom: 28px;
  font-size: 0.95rem;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.step-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
  transition: all var(--transition);
}

.step-card:hover {
  border-color: var(--border-active);
  transform: translateY(-2px);
}

.step-number {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 12px;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.step-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.step-card p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ─── Use Cases ─────────────────────────────────────────────────────── */
.use-cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.use-case {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  text-align: center;
  transition: all var(--transition);
}

.use-case:hover {
  border-color: var(--border-active);
  background: var(--bg-elevated);
}

.use-case-icon { font-size: 2rem; margin-bottom: 8px; display: block; }
.use-case h3 { font-size: 0.88rem; font-weight: 600; margin-bottom: 4px; }
.use-case p  { font-size: 0.78rem; color: var(--text-secondary); }

/* ─── FAQ Section ───────────────────────────────────────────────────── */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.faq-item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--transition);
}

.faq-item:hover { border-color: rgba(255,255,255,0.15); }

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  list-style: none;
  user-select: none;
  gap: 12px;
}

.faq-question::after {
  content: '﹢';
  font-size: 1.2rem;
  color: var(--accent-light);
  flex-shrink: 0;
  transition: transform var(--transition);
}

details[open] .faq-question::after {
  transform: rotate(45deg);
}

.faq-answer {
  padding: 0 20px 16px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ─── Footer ────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.82rem;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  color: var(--text-muted);
  transition: color var(--transition);
}

.footer-links a:hover {
  color: var(--accent-light);
  text-decoration: none;
}

/* ─── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .app-container {
    grid-template-columns: 1fr;
  }

  .canvas-panel {
    position: static;
  }

  .canvas-wrapper, #avatar-canvas {
    width: 240px;
    height: 240px;
  }

  .hero h1 { font-size: 1.8rem; }

  .site-header { flex-wrap: wrap; gap: 8px; }
  .header-tagline { display: none; }
}

@media (max-width: 600px) {
  .canvas-actions { flex-direction: column; }
  .parts-grid { grid-template-columns: repeat(3, 1fr); }
  .features-strip { flex-direction: column; }

  /* On small phones, hide text labels — just show emoji icons */
  .cat-name { display: none; }
  .cat-tab  { padding: 8px 2px; }
  .cat-icon { font-size: 1.25rem; }
}

@media (max-width: 380px) {
  /* Very small phones: shrink tab grid further */
  .category-tabs { gap: 3px; padding: 8px; }
  .cat-tab { padding: 6px 2px; }
}

/* ─── Prose Block ───────────────────────────────────────────────────── */
.prose-block {
  max-width: 820px;
}

.prose-block p {
  font-size: 0.98rem;
  color: var(--text-secondary);
  line-height: 1.85;
  margin-bottom: 18px;
}

.prose-block p:last-child { margin-bottom: 0; }

.prose-block strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* ─── Scroll-reveal util ────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
