/* ============================================================
   mathprog-editor — GitHub Pages Landing + Demo Styles
   ============================================================ */

/* ---------- Reset & Base ---------- */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  transition: background-color 0.25s, color 0.25s;
  line-height: 1.6;
}

body.light {
  background-color: #f0f0f0;
  color: #24292f;
}

body.dark {
  background-color: #010409;
  color: #e6edf3;
}

/* ---------- Nav ---------- */

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 52px;
  border-bottom: 1px solid;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

body.light .site-nav {
  border-color: #d0d7de;
  background: rgba(255, 255, 255, 0.85);
}

body.dark .site-nav {
  border-color: #30363d;
  background: rgba(13, 17, 23, 0.85);
}

.nav-logo {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
  font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, monospace;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.15s;
}

body.light .nav-link { color: #24292f; }
body.dark .nav-link { color: #e6edf3; }

.nav-link:hover {
  opacity: 1;
}

/* ---------- Hero ---------- */

.hero {
  text-align: center;
  padding: 72px 24px 56px;
  max-width: 720px;
  margin: 0 auto;
}

.hero-title {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -1.2px;
  line-height: 1.15;
  margin-bottom: 16px;
}

body.light .hero-title { color: #1a1a2e; }
body.dark .hero-title { color: #f0f6fc; }

.hero-subtitle {
  font-size: 17px;
  line-height: 1.6;
  opacity: 0.7;
  max-width: 560px;
  margin: 0 auto 32px;
}

.hero-install {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid;
  margin-bottom: 24px;
}

body.light .hero-install {
  border-color: #d0d7de;
  background: #ffffff;
}

body.dark .hero-install {
  border-color: #30363d;
  background: #161b22;
}

.install-cmd {
  padding: 10px 16px;
  font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, monospace;
  font-size: 14px;
  user-select: all;
}

.copy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-left: 1px solid;
  cursor: pointer;
  transition: background 0.15s;
}

body.light .copy-btn {
  border-color: #d0d7de;
  background: #f6f8fa;
  color: #57606a;
}

body.dark .copy-btn {
  border-color: #30363d;
  background: #21262d;
  color: #8b949e;
}

body.light .copy-btn:hover { background: #eaeef2; }
body.dark .copy-btn:hover { background: #30363d; }

.hero-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.hero-badges a {
  text-decoration: none;
  line-height: 0;
}

/* ---------- Section Headings ---------- */

.section-heading {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.6px;
  text-align: center;
  margin-bottom: 8px;
}

.section-subheading {
  font-size: 15px;
  text-align: center;
  opacity: 0.6;
  margin-bottom: 24px;
}

/* ---------- Demo Section ---------- */

.demo-section {
  padding: 48px 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.demo-container {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

body.light .demo-container {
  border-color: #d0d7de;
}

body.dark .demo-container {
  border-color: #30363d;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.demo-toolbar {
  padding: 10px 16px;
  border-bottom: 1px solid;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

body.light .demo-toolbar {
  border-color: #d0d7de;
  background: #ffffff;
}

body.dark .demo-toolbar {
  border-color: #30363d;
  background: #0d1117;
}

/* ---------- Theme Palette (reused from demo) ---------- */

.theme-palette {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.theme-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  opacity: 0.45;
  margin-right: 2px;
  margin-left: 4px;
}

.theme-separator {
  width: 1px;
  height: 24px;
  margin: 0 6px;
  opacity: 0.2;
}

body.light .theme-separator { background: #000; }
body.dark .theme-separator { background: #fff; }

.theme-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 6px;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  background: none;
  transition: border-color 0.15s, transform 0.1s;
}

.theme-btn:hover {
  transform: translateY(-1px);
}

body.light .theme-btn:hover { border-color: #c0c8d0; }
body.dark .theme-btn:hover { border-color: #444c56; }

.theme-btn-active { border-color: #0969da !important; }
body.dark .theme-btn-active { border-color: #58a6ff !important; }

.theme-swatch {
  width: 40px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid rgba(128, 128, 128, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0 4px;
}

.theme-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.theme-label {
  font-size: 8px;
  font-weight: 500;
  opacity: 0.6;
  white-space: nowrap;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body.light .theme-label { color: #24292f; }
body.dark .theme-label { color: #e6edf3; }

/* ---------- Example Picker (reused from demo) ---------- */

.example-picker {
  display: flex;
  gap: 6px;
  padding: 8px 16px;
  overflow-x: auto;
  border-bottom: 1px solid;
}

body.light .example-picker {
  border-color: #d0d7de;
  background: #f6f8fa;
}

body.dark .example-picker {
  border-color: #30363d;
  background: #161b22;
}

.example-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  background: none;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
  font-family: inherit;
}

body.light .example-btn:hover {
  background: #eaeef2;
  border-color: #c0c8d0;
}

body.dark .example-btn:hover {
  background: #21262d;
  border-color: #444c56;
}

.example-btn-active { border-color: #0969da !important; }
body.light .example-btn-active { background: #ddf4ff; }

body.dark .example-btn-active {
  border-color: #58a6ff !important;
  background: #0d2035;
}

.example-name {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

body.light .example-name { color: #24292f; }
body.dark .example-name { color: #e6edf3; }

.example-desc {
  font-size: 10px;
  opacity: 0.6;
}

body.light .example-desc { color: #57606a; }
body.dark .example-desc { color: #8b949e; }

/* ---------- Editor Wrapper ---------- */

#editor-wrapper {
  display: flex;
  height: 520px;
  gap: 0;
}

#editor {
  flex: 55;
  overflow: hidden;
}

#editor .cm-editor {
  height: 100%;
  font-size: 13px;
}

#math-panel {
  flex: 45;
  overflow-y: auto;
  border-left: 1px solid;
  min-width: 0;
}

body.light #math-panel {
  background: #fafafa;
  border-color: #d0d7de;
}

body.dark #math-panel {
  background: #0d1117;
  border-color: #30363d;
  color: #e6edf3;
}

/* ---------- Features Section ---------- */

.features-section {
  padding: 64px 24px;
  max-width: 1000px;
  margin: 0 auto;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 32px;
}

.feature-card {
  padding: 24px;
  border-radius: 12px;
  border: 1px solid;
  transition: transform 0.15s, box-shadow 0.15s;
}

body.light .feature-card {
  border-color: #d0d7de;
  background: #ffffff;
}

body.dark .feature-card {
  border-color: #30363d;
  background: #0d1117;
}

.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

body.dark .feature-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.feature-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

body.light .feature-icon {
  background: #ddf4ff;
  color: #0969da;
}

body.dark .feature-icon {
  background: #0d2035;
  color: #58a6ff;
}

.feature-card h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.2px;
}

.feature-card p {
  font-size: 13px;
  opacity: 0.7;
  line-height: 1.5;
}

/* ---------- Quick Start Section ---------- */

.quickstart-section {
  padding: 64px 24px;
  max-width: 900px;
  margin: 0 auto;
}

.quickstart-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 32px;
}

.quickstart-block h3 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.5;
  margin-bottom: 8px;
}

.code-block {
  padding: 16px;
  border-radius: 10px;
  border: 1px solid;
  overflow-x: auto;
  font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre;
}

body.light .code-block {
  border-color: #d0d7de;
  background: #ffffff;
  color: #24292f;
}

body.dark .code-block {
  border-color: #30363d;
  background: #0d1117;
  color: #e6edf3;
}

.code-kw { color: #cf222e; }
.code-str { color: #0a3069; }
.code-fn { color: #8250df; }
.code-attr { color: #0550ae; }

body.dark .code-kw { color: #ff7b72; }
body.dark .code-str { color: #a5d6ff; }
body.dark .code-fn { color: #d2a8ff; }
body.dark .code-attr { color: #79c0ff; }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid;
  padding: 24px;
  margin-top: 24px;
}

body.light .site-footer { border-color: #d0d7de; }
body.dark .site-footer { border-color: #30363d; }

.footer-content {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  opacity: 0.6;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-name {
  font-weight: 700;
  font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, monospace;
}

.footer-sep { opacity: 0.4; }

.site-footer a {
  text-decoration: none;
  font-weight: 600;
}

body.light .site-footer a { color: #0969da; }
body.dark .site-footer a { color: #58a6ff; }

.site-footer a:hover { text-decoration: underline; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .hero-title { font-size: 28px; }
  .hero-subtitle { font-size: 15px; }

  #editor-wrapper {
    flex-direction: column;
    height: 600px;
  }

  #math-panel {
    border-left: none;
    border-top: 1px solid;
    flex: 40;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .quickstart-columns {
    grid-template-columns: 1fr;
  }

  .nav-right {
    gap: 12px;
  }

  .nav-link {
    font-size: 12px;
  }

  .footer-content {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .site-nav {
    padding: 0 12px;
  }

  .hero {
    padding: 48px 16px 40px;
  }

  .demo-section {
    padding: 32px 12px;
  }

  .demo-toolbar {
    overflow-x: auto;
  }
}
