/* ── Reset & Globals ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  font-size: 16px;
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 { color: var(--text-primary); }

/* ── Navbar ── */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: 56px;
  background: rgba(10, 10, 11, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

[data-theme="dark"] #navbar { background: rgba(10, 10, 11, 0.85); }
[data-theme="light"] #navbar { background: rgba(250, 250, 250, 0.85); }

/* ══════════════════════════════════════════════════════════
   SHARED NAVBAR — browse + create pages
   ══════════════════════════════════════════════════════════ */
body:has(#browse-page) #navbar,
body.editor-page #navbar {
  background: #0A0A0B;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  height: 52px;
  backdrop-filter: none;
}

body:has(#browse-page) .nav-logo,
body.editor-page .nav-logo {
  color: #F5F5F3;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
body:has(#browse-page) .logo-text,
body.editor-page .logo-text {
  font-family: 'Sora', 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #F5F5F3;
}
body:has(#browse-page) .logo-icon,
body.editor-page .logo-icon { font-size: 13px; }

body:has(#browse-page) .nav-links,
body.editor-page .nav-links {
  display: flex;
  align-items: center;
  gap: 0;
  height: 52px;
}
body:has(#browse-page) .nav-link,
body.editor-page .nav-link {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6F6F6B;
  padding: 0 20px;
  height: 52px;
  display: flex;
  align-items: center;
  border-radius: 0;
  background: none;
  border: none;
  border-left: 1px solid rgba(255,255,255,0.04);
  text-decoration: none;
  transition: color 150ms, background 150ms;
  white-space: nowrap;
}
body:has(#browse-page) .nav-link:hover,
body.editor-page .nav-link:hover {
  color: #F5F5F3;
  background: rgba(255,255,255,0.02);
}
body:has(#browse-page) .nav-link-active,
body.editor-page .nav-link-active { color: #9A9A97 !important; }

body:has(#browse-page) .nav-link-github,
body.editor-page .nav-link-github { gap: 6px; }

body:has(#browse-page) .theme-toggle,
body.editor-page .theme-toggle {
  height: 52px;
  width: 48px;
  border-radius: 0;
  border: none;
  border-left: 1px solid rgba(255,255,255,0.04);
  background: none;
  color: #6F6F6B;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 150ms;
}
body:has(#browse-page) .theme-toggle:hover,
body.editor-page .theme-toggle:hover {
  color: #F5F5F3;
  background: rgba(255,255,255,0.02);
}

/* light mode */
html[data-theme="light"] body:has(#browse-page) #navbar,
html[data-theme="light"] body.editor-page #navbar { background: #FAFAF8; border-bottom-color: rgba(0,0,0,0.08); }
html[data-theme="light"] body:has(#browse-page) .logo-text,
html[data-theme="light"] body.editor-page .logo-text { color: #111111; }
html[data-theme="light"] body:has(#browse-page) .nav-link,
html[data-theme="light"] body.editor-page .nav-link { color: #888888; border-left-color: rgba(0,0,0,0.04); }
html[data-theme="light"] body:has(#browse-page) .nav-link:hover,
html[data-theme="light"] body.editor-page .nav-link:hover { color: #111111; background: rgba(0,0,0,0.02); }
html[data-theme="light"] body:has(#browse-page) .nav-link-active,
html[data-theme="light"] body.editor-page .nav-link-active { color: #555555 !important; }
html[data-theme="light"] body:has(#browse-page) .theme-toggle,
html[data-theme="light"] body.editor-page .theme-toggle { color: #888888; border-left-color: rgba(0,0,0,0.04); }
html[data-theme="light"] body:has(#browse-page) .theme-toggle:hover,
html[data-theme="light"] body.editor-page .theme-toggle:hover { color: #111111; background: rgba(0,0,0,0.02); }

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

.nav-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.nav-slash {
  color: var(--text-secondary);
  opacity: 0.5;
  font-size: 16px;
  margin-left: 4px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-right: 24px;
}


/* ── Logo build animation ── */
@keyframes logo-build {
  0%   { opacity: 0; letter-spacing: 0.48em; filter: blur(2px); }
  55%  { opacity: 0.9; letter-spacing: 0.20em; filter: blur(0); }
  100% { opacity: 1; letter-spacing: 0.18em; filter: blur(0); }
}
@keyframes logo-icon-drop {
  0%   { opacity: 0; transform: translateY(-4px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-primary);
  transition: color 150ms;
}
.nav-logo:hover .logo-text   { color: #D6B35F; }
.nav-logo:hover .logo-cursor { color: #D6B35F; }
.nav-logo:hover .logo-icon   { color: #D6B35F; }

.logo-icon { animation: logo-icon-drop 300ms ease-out both; }
.logo-text { animation: logo-build 500ms ease-out both; }

.logo-cursor {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 400;
  color: #4A4A47;
  margin-left: -1px;
  animation:
    logo-build 500ms ease-out both,
    cursor-blink 1.2s ease-in-out 600ms infinite;
}

html[data-theme="light"] .logo-cursor { color: #BBBBBB; }
html[data-theme="light"] .nav-logo:hover .logo-text,
html[data-theme="light"] .nav-logo:hover .logo-cursor,
html[data-theme="light"] .nav-logo:hover .logo-icon { color: #C49A38; }

.logo-icon {
  font-size: 18px;
  filter: drop-shadow(0 0 6px var(--accent-glow));
}
.logo-text {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link-github {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
}

.nav-star {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 7px;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  transition: all 150ms var(--ease-out);
  fill: currentColor;
}
.nav-star:hover {
  color: #f59e0b;
  border-color: #f59e0b;
  background: rgba(245,158,11,0.08);
}
.gh-star-count {
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  padding: 1px 6px;
  border-radius: 5px;
  min-width: 20px;
  text-align: center;
}
.nav-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 7px;
  transition: all 150ms var(--ease-out);
}
.nav-link:hover { color: var(--text-primary); background: var(--bg-secondary); }
.nav-link-active { color: var(--text-primary) !important; font-weight: 600; }

/* ── Theme Toggle ── */
.theme-toggle {
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px; /* 8px grid */
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 200ms var(--ease-out);
}
.theme-toggle:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
  transform: scale(1.02);
}
.theme-toggle:active { transform: scale(0.98); }
[data-theme="dark"] .icon-sun  { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun  { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* ── Hero section ── */
#hero {
  position: relative;
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 64px; /* nav height */
  padding-bottom: 80px; /* 80px section padding */
  overflow: hidden;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border-subtle) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-subtle) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.6;
  pointer-events: none;
  mask-image: radial-gradient(ellipse 60% 60% at 50% 50%, black 10%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 60% 60% at 50% 50%, black 10%, transparent 80%);
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 720px;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px; /* 24px gap */
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 100px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  animation: fadeUp 0.6s var(--ease-out) both;
}

.badge-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
  animation: pulse-dot 2s infinite;
}

.hero-title {
  font-size: 56px; /* Spec: 56px */
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  animation: fadeUp 0.6s var(--ease-out) 0.1s both;
}

.hero-subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 520px;
  animation: fadeUp 0.6s var(--ease-out) 0.2s both;
}

/* ── Hero CTA ── */
.hero-cta {
  display: inline-flex;
  margin-top: 8px;
  padding: 12px 20px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  font-size: 16px;
  border-radius: var(--radius-md);
  text-decoration: none;
  box-shadow: var(--shadow-btn);
  transition: all 200ms var(--ease-out);
  animation: fadeUp 0.6s var(--ease-out) 0.3s both;
}
.hero-cta:hover {
  background: var(--accent-hover);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 36px var(--accent-glow);
}
.hero-cta:active {
  transform: scale(0.98);
}

/* ── Animations ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.7; transform: scale(0.85); box-shadow: 0 0 4px var(--accent-glow); }
}

/* ── Studio Builder ── */
#studio-builder {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  overflow: hidden;
}

[data-theme="dark"] {
  --bg-primary: #0a0a0b;
  --bg-secondary: #121214;
  --bg-elevated: #1a1a1d;
  --border-subtle: #27272a;
  --accent: #D6B35F;
  --accent-hover: #c9a44f;
  --accent-glow: rgba(214,179,95,0.2);
}

[data-theme="light"] {
  --bg-primary: #FAFAF8;
  --bg-secondary: #F4F4F2;
  --bg-elevated: #FFFFFF;
  --border-subtle: rgba(0,0,0,0.08);
  --text-primary: #111111;
  --text-secondary: #555555;
  --accent: #C49A38;
  --accent-hover: #B08A2E;
  --accent-glow: rgba(196,154,56,0.1);
}

.studio-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.studio-breadcrumb {
  font-size: 14px;
  font-weight: 500;
}
.studio-breadcrumb .muted { color: var(--text-secondary); }
.studio-breadcrumb .highlight { color: var(--text-primary); }

.studio-type-selector select {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

.studio-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}
.studio-status {
  font-size: 13px;
  color: var(--text-secondary);
}

.studio-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
}
.studio-btn-secondary {
  background: transparent;
  border-color: var(--border-subtle);
  color: var(--text-primary);
}
.studio-btn-secondary:hover {
  background: var(--bg-elevated);
}
.studio-btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 10px var(--accent-glow);
}
.studio-btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 16px var(--accent-glow);
}

/* Container & Panes */
.studio-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.studio-pane {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: var(--bg-primary);
}

.studio-left-pane { flex: 0 0 280px; background: var(--bg-secondary); }
.studio-center-pane { flex: 1; min-width: 400px; padding: 40px; }
.studio-right-pane { flex: 0 0 400px; background: var(--bg-secondary); }

.studio-divider {
  width: 1px;
  background: var(--border-subtle);
  cursor: col-resize;
  position: relative;
  z-index: 10;
}
.studio-divider::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: -3px; right: -3px;
  cursor: col-resize;
}
.studio-divider:hover { background: var(--accent); }

/* Left Pane Details */
.pane-header {
  padding: 16px 20px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  font-weight: 600;
  border-bottom: 1px solid var(--border-subtle);
}

.structure-list {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.structure-block-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  border: 1px solid transparent;
}
.structure-block-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}
.structure-block-item.active {
  background: rgba(124, 58, 237, 0.1);
  color: var(--text-primary);
  border-color: rgba(124, 58, 237, 0.2);
}
.structure-block-item .icon {
  margin-right: 10px;
  opacity: 0.7;
}

.add-block-btn {
  margin: 0 12px 12px;
  padding: 10px;
  background: transparent;
  border: 1px dashed var(--border-subtle);
  color: var(--text-secondary);
  border-radius: 8px;
  cursor: pointer;
  transition: 0.2s;
}
.add-block-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--text-primary);
}

.completion-meter {
  padding: 16px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-secondary);
}
.completion-bar-bg {
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}
.completion-bar-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s;
}

/* Center Pane Details */
.canvas-header {
  margin-bottom: 32px;
}
.canvas-title-input {
  width: 100%;
  background: transparent;
  border: none;
  font-size: 36px;
  font-weight: 800;
  color: var(--text-primary);
  outline: none;
  font-family: var(--font-sans);
}
.canvas-title-input::placeholder { color: var(--text-secondary); opacity: 0.5; }

.canvas-body {
  max-width: 700px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--text-secondary);
  opacity: 0.6;
}
.empty-state svg {
  width: 48px; height: 48px;
  margin-bottom: 16px;
}

/* Rich Form Elements */
.rich-form-group {
  margin-bottom: 32px;
  animation: fadeUp 0.3s ease-out;
}
.rich-form-group label {
  display: flex;
  align-items: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.rich-form-group label .icon {
  margin-right: 8px;
  color: var(--accent);
}
.rich-input, .rich-textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font-sans);
  line-height: 1.5;
  transition: 0.2s;
  outline: none;
}
.rich-textarea {
  resize: vertical;
  min-height: 120px;
}
.rich-input:focus, .rich-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.ai-helper-bar {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: rgba(124, 58, 237, 0.1);
  color: var(--accent);
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: 0.2s;
}
.ai-btn:hover {
  background: rgba(124, 58, 237, 0.2);
}

/* Triggers Chips */
.trigger-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.trigger-chip {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.trigger-chip .remove {
  cursor: pointer;
  color: var(--text-secondary);
}
.trigger-chip .remove:hover { color: #ef4444; }
.trigger-input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  outline: none;
  font-size: 13px;
  padding: 6px 0;
  width: 150px;
}

/* Right Pane Details */
.pane-header-right {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
}
.segmented-control {
  display: flex;
  background: var(--bg-elevated);
  border-radius: 8px;
  padding: 4px;
  border: 1px solid var(--border-subtle);
}
.seg-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: 0.2s;
}
.seg-btn.active {
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.window-actions {
  display: flex;
  gap: 8px;
}
.window-actions button {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}
.window-actions button:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}
.window-actions svg { width: 16px; height: 16px; }

.preview-body {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* Visual Preview Styles */
.visual-preview {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
}
.visual-preview h1 { font-size: 24px; font-weight: 700; margin-bottom: 24px; border-bottom: 1px solid var(--border-subtle); padding-bottom: 8px;}
.visual-preview h2 { font-size: 18px; font-weight: 600; margin: 24px 0 16px; color: var(--accent); }
.visual-preview p { margin-bottom: 16px; color: var(--text-secondary); }
.visual-preview blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 16px;
  margin: 16px 0;
  color: var(--text-primary);
  font-style: italic;
  background: var(--bg-elevated);
  padding: 12px 16px;
  border-radius: 8px;
}
.visual-preview ul { margin-left: 20px; margin-bottom: 16px; color: var(--text-secondary); }
.visual-preview li { margin-bottom: 8px; }
.visual-preview code {
  background: var(--bg-elevated);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 13px;
  border: 1px solid var(--border-subtle);
}

#rawPreview pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-primary);
  white-space: pre-wrap;
}

/* Syntax Highlight Classes */
.hl-heading { color: #D6B35F; font-weight: 600; }
.hl-step { color: #10b981; }
.hl-bold { font-weight: 700; color: #f8fafc; }
.hl-code { color: #64748b; }

/* ── Share Banner ── */
.share-banner {
  margin-top: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: fadeUp 0.4s var(--ease-out) both;
}
.share-pending-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.share-pending-icon { font-size: 16px; }
.share-pending-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}
.share-pending-msg {
  color: var(--text-secondary);
  line-height: 1.5;
  font-size: 13px;
}
.share-pending-msg strong { color: var(--text-primary); }
.share-install-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}
.share-install-cmd {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
}
.share-copy {
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
  padding: 4px 10px;
  white-space: nowrap;
  transition: border-color 0.2s, color 0.2s;
}
.share-copy:hover { border-color: var(--accent); color: var(--accent); }
.share-pending-note {
  color: var(--text-secondary);
  font-size: 12px;
  opacity: 0.7;
}

/* ── How it works ── */
#how-it-works {
  padding: 80px 24px;
  background: var(--bg-primary);
}
.how-inner {
  max-width: 1000px;
  margin: 0 auto;
}
.section-title {
  text-align: center;
  font-size: 28px; /* Section Title Spec */
  font-weight: 600;
  margin-bottom: 48px;
  color: var(--text-primary);
}
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px; /* Card padding */
  opacity: 0;
  transform: translateY(20px);
  transition: all 400ms var(--ease-out);
  box-shadow: var(--shadow-sm);
}
.card.reveal {
  opacity: 1;
  transform: translateY(0);
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--text-secondary);
}
.card-icon {
  width: 48px; height: 48px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 20px;
  margin-bottom: 24px;
  transition: all 200ms var(--ease-out);
}
.card:hover .card-icon {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 4px 12px var(--accent-glow);
}
.card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
}
.card p {
  color: var(--text-secondary);
  line-height: 1.5;
  font-size: 16px;
}

/* ── Hero Actions (dual CTA) ── */
.hero-actions {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}
.hero-cta-secondary {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition: color 200ms var(--ease-out);
  animation: fadeUp 0.6s var(--ease-out) 0.4s both;
}
.hero-cta-secondary:hover { color: var(--text-primary); }

/* ── Nav active state ── */
.nav-link-active {
  color: var(--text-primary) !important;
  font-weight: 600;
}

/* ── Browse Page ── */
#browse-page {
  padding-top: 56px;
  min-height: 100vh;
}
.browse-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 56px 24px 100px;
}

/* Header */
.browse-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 40px;
  gap: 16px;
}
.browse-title {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}
.browse-subtitle {
  color: var(--text-secondary);
  font-size: 15px;
}
.browse-create-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  background: var(--accent);
  color: #fff;
  border-radius: 9px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 150ms;
  flex-shrink: 0;
}
.browse-create-btn:hover { background: var(--accent-hover); }

/* Search */
.browse-search-bar {
  position: relative;
  margin-bottom: 24px;
}
.browse-search-bar .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}
.browse-search {
  width: 100%;
  padding: 12px 16px 12px 42px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  transition: border-color 150ms, box-shadow 150ms;
}
.browse-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.browse-search::placeholder { color: var(--text-secondary); }

/* Filter tabs */
.filter-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 36px;
}
.filter-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 100px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 150ms var(--ease-out);
  font-family: var(--font-sans);
}
.filter-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
  background: var(--bg-secondary);
}
.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}

/* ── Skill Grid ── */
.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

/* ── Skill Card ── */
.skill-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 200ms var(--ease-out), box-shadow 200ms var(--ease-out), border-color 200ms;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05), 0 2px 8px rgba(0,0,0,0.04);
}
.skill-card:hover {}
.skill-card-body {
  padding: 22px 22px 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.skill-card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.skill-tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 3px 9px;
  border-radius: 100px;
}
.skill-slug {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  opacity: 0.55;
  flex-shrink: 0;
}
.skill-card-content { display: flex; flex-direction: column; gap: 6px; }
.skill-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.skill-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.skill-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
}
.skill-meta-text {
  font-size: 12px;
  color: var(--text-secondary);
  opacity: 0.7;
}
.skill-installs-count {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Card footer */
.skill-card-footer {
  display: flex;
  gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid var(--border-subtle);
}
.skill-install-primary {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background 150ms, transform 100ms;
}
.skill-install-primary:hover { background: var(--accent-hover); }
.skill-install-primary:active { transform: scale(0.98); }
.skill-view-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  font-family: var(--font-sans);
  transition: all 150ms;
  white-space: nowrap;
}
.skill-view-secondary:hover { color: var(--text-primary); border-color: var(--text-secondary); }

.browse-empty {
  color: var(--text-secondary);
  grid-column: 1 / -1;
  text-align: center;
  padding: 64px 0;
  font-size: 15px;
}

/* ══════════════════════════════════════════════════════════
   INSTALL MODAL — command panel
   ══════════════════════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(2px);
  z-index: 200;
}
.modal-overlay.open { display: block; }

.install-modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 201;
  width: min(540px, calc(100vw - 32px));
  background: #0F1012;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
}
.install-modal.open { display: flex; flex-direction: column; }

/* Header */
.im-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.im-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.im-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6F6F6B;
}
.im-slug {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  color: #F5F5F3;
  letter-spacing: -0.01em;
}
.im-close {
  background: none;
  border: none;
  color: #6F6F6B;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 150ms;
  border-radius: 0;
}
.im-close:hover { color: #F5F5F3; }

/* Body */
.im-body {
  padding: 24px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  max-height: 72vh;
}

/* ── OS tabs ── */
.im-os-tabs {
  display: flex;
  gap: 6px;
}
.im-os-tab {
  padding: 5px 14px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.im-os-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ── Primary command block ── */
.im-primary { display: flex; flex-direction: column; gap: 8px; }

.im-section-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #6F6F6B;
}

.im-cmd-block {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  background: #0A0A0B;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 0;
  padding: 14px 16px;
}
.im-cmd-primary {
  background: #0A0A0B;
  border-color: rgba(255,255,255,0.10);
  border-left: 2px solid rgba(214,179,95,0.5);
  padding-left: 14px;
}
.im-cmd-block code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #F5F5F3;
  line-height: 1.7;
  word-break: break-all;
  flex: 1;
}

.im-copy-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.08);
  color: #6F6F6B;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 0;
  cursor: pointer;
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
  transition: color 150ms, border-color 150ms;
  flex-shrink: 0;
  margin-top: 2px;
}
.im-copy-btn:hover { color: #D6B35F; border-color: rgba(214,179,95,0.4); }
.im-copy-btn.copied { color: #D6B35F; border-color: rgba(214,179,95,0.4); }

/* ── Collapsible steps ── */


.im-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
}
.im-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.im-step:last-child { border-bottom: none; }
.im-step-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  color: #6F6F6B;
  width: 20px;
  flex-shrink: 0;
  padding-top: 1px;
}
.im-step-body { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.im-step-title {
  font-size: 11px;
  font-weight: 500;
  color: #9A9A97;
  letter-spacing: 0.02em;
}

/* ── Usage line ── */
.im-usage {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: #0A0A0B;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 0;
}
.im-usage-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #6F6F6B;
  white-space: nowrap;
  flex-shrink: 0;
}
.im-usage-cmd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  color: #D6B35F;
  letter-spacing: -0.01em;
}

/* ── Install modal: light mode ── */
html[data-theme="light"] .install-modal {
  background: #F4F4F2 !important;
  border-color: rgba(0,0,0,0.08) !important;
}
html[data-theme="light"] .im-header {
  background: #F4F4F2;
  border-bottom-color: rgba(0,0,0,0.08) !important;
}
html[data-theme="light"] .im-body { background: #F4F4F2; }
html[data-theme="light"] .im-label { color: #888888 !important; }
html[data-theme="light"] .im-slug { color: #111111 !important; }
html[data-theme="light"] .im-close { color: #888888 !important; }
html[data-theme="light"] .im-close:hover { color: #111111 !important; }
html[data-theme="light"] .im-section-label { color: #888888 !important; }
html[data-theme="light"] .im-cmd-block {
  background: #FFFFFF !important;
  border-color: rgba(0,0,0,0.08) !important;
}
html[data-theme="light"] .im-cmd-primary {
  background: #FFFFFF !important;
  border-color: rgba(0,0,0,0.10) !important;
  border-left-color: rgba(196,154,56,0.5) !important;
}
html[data-theme="light"] .im-cmd-block code { color: #111111 !important; }
html[data-theme="light"] .im-copy-btn {
  color: #888888 !important;
  border-color: rgba(0,0,0,0.1) !important;
}
html[data-theme="light"] .im-copy-btn:hover { color: #C49A38 !important; border-color: rgba(196,154,56,0.4) !important; }
html[data-theme="light"] .im-copy-btn.copied { color: #C49A38 !important; border-color: rgba(196,154,56,0.4) !important; }
html[data-theme="light"] .im-steps { border-color: rgba(0,0,0,0.08) !important; background: #F4F4F2; }
html[data-theme="light"] .im-step { border-bottom-color: rgba(0,0,0,0.06) !important; }
html[data-theme="light"] .im-step-num { color: #888888 !important; }
html[data-theme="light"] .im-step-title { color: #555555 !important; }
html[data-theme="light"] .im-usage {
  background: #FFFFFF !important;
  border-color: rgba(0,0,0,0.06) !important;
}
html[data-theme="light"] .im-usage-label { color: #888888 !important; }
html[data-theme="light"] .im-usage-cmd { color: #C49A38 !important; }

/* ── Form Sections (nuwa-skill structure) ── */
.form-section {
  margin-bottom: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border-subtle);
}
.form-section:last-of-type { border-bottom: none; }

.form-section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.form-section-label .hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.6;
  margin-left: 4px;
}

.add-btn-full {
  width: 100%;
  justify-content: center;
  margin-top: 8px;
  border: 1px dashed var(--border-subtle);
  border-radius: 8px;
  padding: 8px;
}
.add-btn-full:hover { border-color: var(--accent); }

/* Model card multi-field layout */
.model-fields {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.model-name {
  font-weight: 600;
  font-size: 13px;
}
.model-oneliner, .model-application, .model-limits {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Heuristic card extra input */
.heuristic-name {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
}

/* Highlight bold in preview */
.hl-bold { color: var(--text-primary); font-weight: 600; }

/* ── Footer ── */
#footer {
  padding: 48px 24px;
  background: var(--bg-primary);
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.footer-inner p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ── Mobile Responsive ── */
@media (max-width: 800px) {
  #hero {
    padding-top: 100px;
    padding-bottom: 64px;
  }
  .hero-title { font-size: 40px; }
  
  #builder {
    padding: 24px 16px;
  }
  
  .builder-container {
    flex-direction: column;
    height: auto;
    min-height: auto;
  }
  
  .divider {
    width: 100%;
    height: 1px;
    cursor: row-resize;
    border: none;
    border-top: 1px solid var(--border-subtle);
  }
  .divider-line {
    width: 24px;
    height: 2px;
  }
  
  .left-pane, .right-pane {
    flex-basis: auto !important;
    width: 100%;
  }
  
  .left-pane {
    border-bottom: 1px solid var(--border-subtle);
  }
  
  .right-pane {
    height: 400px;
  }
  
  .window-body {
    padding: 16px;
  }
  
  .forge-btn {
    position: sticky;
    bottom: 24px;
    z-index: 10;
  }
}

/* ── Browse loading ── */
.browse-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 80px 0;
  grid-column: 1 / -1;
  width: 100%;
}
.browse-spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skill-meta {
  font-size: 11px;
  color: var(--text-secondary);
  opacity: 0.6;
  margin-top: 6px;
}

/* ── Pagination ── */
.pagination { margin-top: 40px; }
.pagination-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.page-info {
  font-size: 13px;
  color: var(--text-secondary);
}
.page-controls {
  display: flex;
  gap: 4px;
  align-items: center;
}
.page-btn {
  padding: 6px 12px;
  border-radius: 7px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 150ms;
  min-width: 36px;
}
.page-btn:hover:not(:disabled) { color: var(--text-primary); border-color: var(--accent); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── Skill new badge ── */
.skill-new-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 2px 7px;
  border-radius: 100px;
}

/* ── Card action buttons ── */
.skill-preview-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  background: transparent;
  cursor: pointer;
  transition: all 150ms;
  white-space: nowrap;
}
.skill-preview-btn:hover { color: var(--text-primary); border-color: var(--text-secondary); }
.skill-preview-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.skill-github-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  flex-shrink: 0;
  transition: all 150ms;
}
.skill-github-btn:hover { color: var(--text-primary); border-color: var(--text-secondary); }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — BROWSE & CREATE NAVBAR + MODAL
   ══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  /* Reduce nav link padding */
  body:has(#browse-page) .nav-link,
  body.editor-page .nav-link {
    padding: 0 12px;
    font-size: 9px;
  }

  /* Install modal: bottom sheet */
  .install-modal {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    border-left: none;
    border-right: none;
    border-bottom: none;
    border-radius: 0;
    max-height: 90vh;
  }
  .im-body {
    max-height: 72vh;
    padding: 20px 16px 16px;
  }
  .im-header { padding: 14px 16px; }
  /* Long install commands must wrap inside the code block */
  .im-cmd-block code {
    word-break: break-all;
    overflow-wrap: break-word;
    font-size: 11px;
  }
  .im-usage-cmd {
    word-break: break-all;
    overflow-wrap: break-word;
  }
}

@media (max-width: 480px) {
  /* Squeeze nav links tighter — keep Browse + Create visible */
  body:has(#browse-page) .nav-link,
  body.editor-page .nav-link {
    padding: 0 6px;
    font-size: 9px;
  }
  /* GitHub: icon only — reclaims ~50px */
  body:has(#browse-page) .nav-link-github,
  body.editor-page .nav-link-github {
    font-size: 0;
    padding: 0 10px;
  }
  body:has(#browse-page) .nav-link-github svg,
  body.editor-page .nav-link-github svg {
    width: 15px;
    height: 15px;
    display: block;
  }
}
