/* Manifold.rs Demo — Main Stylesheet */

:root {
  --sidebar-width: 260px;
  --bg: #fafafa;
  --bg-card: #ffffff;
  --text: #1a1a2e;
  --text-secondary: #555;
  --text-muted: #999;
  --accent: #4488cc;
  --accent-light: #e8f2fc;
  --border: #e0e0e0;
  --border-light: #f0f0f0;
  --sidebar-bg: #1a1a2e;
  --sidebar-text: #c8c8d4;
  --sidebar-active: #4488cc;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

/* ===================== Sidebar Navigation ===================== */

#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
}

.logo-accent {
  color: var(--sidebar-active);
}

.tagline {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.45);
  margin-top: 4px;
}

.nav-list {
  list-style: none;
  padding: 12px 0;
  flex: 1;
}

.nav-section {
  padding: 16px 20px 4px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.3);
  font-weight: 600;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.92rem;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}

.nav-link:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}

.nav-link.active {
  background: rgba(68,136,204,0.12);
  color: var(--sidebar-active);
  border-left-color: var(--sidebar-active);
  font-weight: 600;
}

.nav-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  opacity: 0.7;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.8rem;
}

.sidebar-footer a {
  color: var(--sidebar-active);
  text-decoration: none;
}

.sidebar-footer p {
  margin-bottom: 4px;
}

.license {
  color: rgba(255,255,255,0.3);
}

.capture-btn {
  width: 100%;
  padding: 8px;
  margin-bottom: 10px;
  background: rgba(68,136,204,0.2);
  color: var(--sidebar-active);
  border: 1px solid rgba(68,136,204,0.4);
  border-radius: 4px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s;
}

.capture-btn:hover {
  background: rgba(68,136,204,0.35);
}

.capture-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.capture-btn.capturing {
  animation: pulse 1s infinite alternate;
}

@keyframes pulse {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

/* ===================== Main Content ===================== */

#main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding: 24px 32px;
}

/* ===================== Home Page ===================== */

.home-page {
  max-width: 900px;
  margin: 0 auto;
}

.github-badge {
  margin-bottom: 16px;
}

.github-badge-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
  transition: border-color 0.2s;
}

.github-badge-link:hover {
  border-color: var(--accent);
}

.hero {
  margin-bottom: 32px;
}

.hero h1 {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 12px;
}

.hero h1 span {
  color: var(--accent);
}

.hero p {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 700px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.feature-card {
  display: block;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.card-thumb {
  width: 100%;
  height: 120px;
  background-size: cover;
  background-position: center;
  background-color: #f0f0f0;
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
  margin: -20px -20px 12px -20px;
  width: calc(100% + 40px);
}

.card-icon {
  font-size: 1.5rem;
  display: block;
  margin-bottom: 8px;
}

.feature-card h3 {
  font-size: 1rem;
  margin-bottom: 6px;
}

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

.about-section {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.about-section h2 {
  font-size: 1.3rem;
  margin-bottom: 12px;
}

.about-section p {
  color: var(--text-secondary);
  max-width: 700px;
}

.about-section a {
  color: var(--accent);
  text-decoration: none;
}

.about-section a:hover {
  text-decoration: underline;
}

.stats-row {
  display: flex;
  gap: 32px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.stat {
  text-align: center;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ===================== Demo Pages ===================== */

.demo-page {
  max-width: 1200px;
  margin: 0 auto;
}

.demo-header {
  margin-bottom: 20px;
}

.demo-header h2 {
  font-size: 1.5rem;
  margin-bottom: 6px;
}

.demo-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.demo-note {
  margin-top: 8px;
  padding: 8px 12px;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: var(--radius);
  font-size: 0.88rem;
  color: #6d4c00;
}

.demo-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  height: calc(100vh - 160px);
  min-height: 400px;
}

.demo-canvas-area {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.demo-canvas-area canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.demo-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ===================== Controls ===================== */

.control-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.control-group label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.slider-value {
  font-weight: 600;
  color: var(--accent);
  min-width: 40px;
  text-align: right;
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  font-size: 0.9rem;
  color: var(--text);
}

.control-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  cursor: pointer;
  color: var(--text-secondary);
}

.control-checkbox input {
  accent-color: var(--accent);
}

.control-btn {
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s;
}

.control-btn:hover {
  background: #3377bb;
}

.info-readout {
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  font-size: 0.85rem;
  line-height: 1.8;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.info-readout .label {
  color: var(--text-muted);
}

.info-readout .value {
  font-weight: 600;
  color: var(--text);
}

/* ===================== About Content ===================== */

.about-content {
  max-width: 750px;
}

.about-content h3 {
  font-size: 1.1rem;
  margin: 24px 0 8px;
}

.about-content p, .about-content li {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.7;
}

.about-content ul {
  padding-left: 24px;
  margin: 8px 0;
}

.about-content a {
  color: var(--accent);
  text-decoration: none;
}

.about-content a:hover {
  text-decoration: underline;
}

.about-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.88rem;
}

.about-table th, .about-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.about-table th {
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
}

.about-table td {
  color: var(--text-secondary);
}

.about-table code {
  background: var(--accent-light);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.85em;
}

/* ===================== Mobile Hamburger ===================== */

.menu-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  background: var(--sidebar-bg);
  border: none;
  border-radius: 6px;
  padding: 10px;
  cursor: pointer;
  flex-direction: column;
  gap: 4px;
}

.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  transition: transform 0.3s, opacity 0.3s;
}

.menu-toggle.open span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.menu-toggle.open span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.open span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.4);
  z-index: 90;
}

.sidebar-overlay.visible {
  display: block;
}

/* ===================== Responsive ===================== */

@media (max-width: 900px) {
  .menu-toggle {
    display: flex;
  }

  #sidebar {
    transform: translateX(-100%);
  }

  #sidebar.open {
    transform: translateX(0);
  }

  #main-content {
    margin-left: 0;
    padding: 16px;
    padding-top: 56px;
  }

  .demo-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .demo-canvas-area {
    min-height: 400px;
  }

  .demo-controls {
    max-height: 300px;
  }
}

/* ===================== Scrollbar ===================== */

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

#sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
}
