/* ─── Design Tokens ─── */
:root {
  --primary: #4A90D9;
  --primary-dark: #2C5F8A;
  --surface: #F5F7FA;
  --surface-dark: #1E1E2E;
  --text: #1D2939;
  --text-secondary: #475467;
  --text-muted: #98A2B3;
  --border: #D0D5DD;
  --success: #12B76A;
  --error: #F04438;
  --white: #FFFFFF;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.1), 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, 0.12);
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--white);
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── Header ─── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  border-bottom: 1px solid var(--border);
  background: var(--white);
  flex-shrink: 0;
  z-index: 100;
}

.logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  letter-spacing: -0.5px;
}
.logo span { color: var(--text); }

nav { display: flex; gap: 4px; }

nav a {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}
nav a:hover { background: var(--surface); color: var(--text); }
nav a.active { background: var(--primary); color: var(--white); }

.header-right { display: flex; align-items: center; gap: 12px; }
.github-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}
.github-link:hover { color: var(--text); }

/* ─── Sections ─── */
.section {
  display: none;
  flex: 1;
  overflow: hidden;
}
.section.active { display: flex; flex-direction: column; }

/* ─── Home ─── */
#home {
  overflow-y: auto;
  align-items: center;
}

.hero {
  text-align: center;
  padding: 80px 24px 40px;
  max-width: 720px;
}
.hero h1 {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1.1;
  margin-bottom: 16px;
}
.hero h1 em {
  font-style: normal;
  color: var(--primary);
}
.hero p {
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 32px;
}

.cta-group { display: flex; gap: 12px; justify-content: center; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}
.btn-primary {
  background: var(--primary);
  color: var(--white);
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
}
.btn-secondary:hover { background: var(--border); }

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding: 40px 24px 80px;
  max-width: 960px;
  width: 100%;
}

.feature-card {
  padding: 32px 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  text-align: left;
}
.feature-card .icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 16px;
}
.feature-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}
.feature-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.code-preview {
  max-width: 640px;
  width: 100%;
  padding: 0 24px 80px;
}
.code-preview h2 {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.code-block {
  background: var(--surface-dark);
  color: #CDD6F4;
  border-radius: var(--radius);
  padding: 24px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  overflow-x: auto;
}
.code-block .kw { color: #CBA6F7; }
.code-block .str { color: #A6E3A1; }
.code-block .fn { color: #89B4FA; }
.code-block .cm { color: #6C7086; }

/* ─── Playground ─── */
.playground-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.playground-toolbar select {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--white);
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  cursor: pointer;
}

.toolbar-btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--white);
  font-size: 13px;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  color: var(--text);
  transition: all 0.15s;
}
.toolbar-btn:hover { background: var(--surface); border-color: var(--text-muted); }
.toolbar-btn.primary { background: var(--primary); color: var(--white); border-color: var(--primary); }
.toolbar-btn.primary:hover { background: var(--primary-dark); }
.toolbar-btn.mode-toggle {
  background: var(--surface-dark);
  color: var(--white);
  border-color: var(--surface-dark);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  min-width: 48px;
  text-align: center;
}
.toolbar-btn.mode-toggle:hover { opacity: 0.85; }

.status {
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 4px;
}
.status.success { color: var(--success); }
.status.error { color: var(--error); background: #FEF3F2; }

.playground-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1;
  overflow: hidden;
}

.editor-panel {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  overflow: hidden;
}
#editor-container {
  flex: 1;
  min-height: 0;
}

.preview-panel {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle, var(--border) 1px, transparent 1px);
  background-size: 20px 20px;
  cursor: grab;
  user-select: none;
}

#svg-preview {
  transform-origin: 0 0;
  position: absolute;
  top: 0;
  left: 0;
}
#svg-preview svg {
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.08));
  background: white;
  border-radius: 8px;
}

/* Zoom Controls */
.zoom-controls {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  box-shadow: var(--shadow);
  z-index: 10;
  cursor: default;
}
.zoom-controls button {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
}
.zoom-controls button:hover {
  background: var(--surface);
  color: var(--text);
}
#zoom-level {
  font-size: 12px;
  font-weight: 600;
  font-family: var(--mono);
  color: var(--text-secondary);
  min-width: 40px;
  text-align: center;
}

/* ─── Icons ─── */
#icons { overflow-y: auto; padding: 24px; }
.icons-content { max-width: 1200px; width: 100%; margin: 0 auto; }
.icons-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.icons-search {
  flex: 1;
  max-width: 400px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: var(--sans);
  outline: none;
}
.icons-search:focus { border-color: var(--primary); }
.icons-search::placeholder { color: var(--text-secondary); }
.icons-stats { color: var(--text-secondary); font-size: 13px; }
.icons-loading { text-align: center; padding: 60px; color: var(--text-secondary); }
.provider-section { margin-bottom: 32px; }
.provider-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.provider-name { font-size: 18px; font-weight: 700; color: var(--text); }
.provider-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-secondary);
}
.provider-meta { font-size: 12px; color: var(--text-secondary); }
.category-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 14px 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 6px;
}
.icon-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.icon-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}
.icon-card.hidden { display: none; }
.icon-preview { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; }
.icon-preview svg { width: 36px; height: 36px; }
.icon-name { font-size: 10px; color: var(--text-secondary); text-align: center; word-break: break-all; line-height: 1.2; }
.icon-card .dsl-hint { font-size: 9px; color: var(--text-secondary); font-family: var(--mono); opacity: 0.6; }
.copied-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 8px 16px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius);
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  z-index: 100;
}
.copied-toast.show { opacity: 1; }

/* ─── Docs ─── */
#docs { overflow-y: auto; padding: 48px 24px; align-items: center; }
.docs-content { max-width: 720px; width: 100%; }
.docs-content h2 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}
.docs-content h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 32px 0 12px;
}
.docs-content p, .docs-content li {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 12px;
}
.docs-content ul { padding-left: 20px; }
.docs-content code {
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 13px;
}
.docs-content pre {
  background: var(--surface-dark);
  color: #CDD6F4;
  padding: 20px;
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
  margin-bottom: 20px;
}
.schema-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 24px;
  font-size: 14px;
}
.schema-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--surface);
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}
.schema-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
.schema-table code { font-size: 12px; }

/* ─── Monaco Editor Overrides ─── */

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .features { grid-template-columns: 1fr; }
  .hero h1 { font-size: 32px; }
  .playground-content { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .editor-panel { border-right: none; border-bottom: 1px solid var(--border); }
}
