/* QuranFlow Process Site — Apple-clean + GitHub markdown */

:root {
  --text-primary: #1d1d1f;
  --text-secondary: #515154;
  --text-tertiary: #6e6e73;
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f7;
  --bg-code: #f6f8fa;
  --border: #d2d2d7;
  --border-light: #e8e8ed;
  --accent: #2d6a4f;
  --accent-light: #eaf4f0;
  --link: #06c;
  --stage-number: #6e6e73;
  --max-width: 720px;
  --max-width-wide: 980px;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--text-primary);
  background: var(--bg-primary);
  line-height: 1.65;
}

/* ─── SITE HEADER ─── */

.site-header {
  padding: 80px 24px 60px;
  text-align: center;
  border-bottom: 1px solid var(--border-light);
}

.site-header h1 {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 12px;
}

.site-header .subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  font-weight: 400;
  max-width: 600px;
  margin: 0 auto;
}

/* ─── CONTAINER ─── */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.container-wide {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 0 24px;
}

/* ─── INTRO ─── */

.intro {
  padding: 60px 24px 40px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.intro p {
  font-size: 1.125rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 16px;
}

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

/* ─── PIPELINE OVERVIEW ─── */

.pipeline-overview {
  padding: 40px 24px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 20px;
}

.pipeline-overview h2 {
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: 32px;
}

.pipeline-steps {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: var(--max-width-wide);
  margin: 0 auto;
}

.pipeline-step {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pipeline-step a {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  padding: 6px 14px;
  background: white;
  border: 1px solid var(--border-light);
  border-radius: 20px;
  transition: all 0.2s;
  white-space: nowrap;
}

.pipeline-step a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pipeline-step .arrow {
  color: var(--text-tertiary);
  font-size: 0.75rem;
}

/* ─── STAGE SECTIONS ─── */

.stage {
  padding: 60px 24px;
  max-width: var(--max-width);
  margin: 0 auto;
  border-bottom: 1px solid var(--border-light);
}

.stage:last-of-type {
  border-bottom: none;
}

.stage-label {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--stage-number);
  margin-bottom: 8px;
}

.stage h2 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 8px;
}

.stage .date {
  font-size: 0.875rem;
  color: var(--text-tertiary);
  margin-bottom: 24px;
}

/* Input → Output flow */

.flow {
  display: flex;
  align-items: stretch;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.flow-item {
  flex: 1;
  min-width: 200px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  background: var(--bg-secondary);
}

.flow-item.output {
  background: var(--accent-light);
  border-color: #c8e0d5;
}

.flow-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

.flow-item.output .flow-label {
  color: var(--accent);
}

.flow-item p {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-primary);
  margin: 0;
}

.flow-item .flow-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}

.flow-item .flow-link:hover {
  text-decoration: underline;
}

.flow-item .flow-link + .flow-link {
  margin-left: 12px;
}

.flow-arrow {
  display: flex;
  align-items: center;
  font-size: 1.25rem;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

/* Stage content */

.stage-content p {
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.stage-content p:last-child {
  margin-bottom: 0;
}

.stage-content ul, .stage-content ol {
  margin: 0 0 16px 24px;
  line-height: 1.7;
}

.stage-content li {
  margin-bottom: 6px;
}

.stage-content strong {
  font-weight: 600;
}

/* Blockquotes */

.stage-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 20px;
  margin: 20px 0;
  background: var(--bg-secondary);
  border-radius: 0 8px 8px 0;
}

.stage-content blockquote p {
  font-size: 0.9375rem;
  color: var(--text-primary);
  font-style: normal;
  margin-bottom: 8px;
}

.stage-content blockquote p:last-child {
  margin-bottom: 0;
}

/* Source links */

.source-links {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.source-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  padding: 6px 14px;
  border: 1px solid #c8e0d5;
  border-radius: 8px;
  background: var(--accent-light);
  transition: all 0.2s;
}

.source-link:hover {
  background: #d4ebe2;
  border-color: var(--accent);
}

/* CTA Button */
.mockup-cta {
  text-align: center;
  margin: 32px 0 16px;
}

.mockup-cta a.cta-button {
  display: inline-block;
  padding: 16px 40px;
  font-size: 1.0625rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border-radius: 12px;
  text-decoration: none;
  letter-spacing: -0.01em;
  transition: background 0.15s ease;
}

.mockup-cta a.cta-button:hover {
  background: #245a42;
}

.mockup-cta .cta-subtitle {
  display: block;
  margin-top: 10px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Evolution table */

.evolution-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.875rem;
}

.evolution-table th {
  text-align: left;
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 2px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.evolution-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}

.evolution-table tr:last-child td {
  border-bottom: none;
}

.evolution-table code {
  font-size: 0.8125rem;
  background: var(--bg-code);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Stats grid */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.stat-card {
  text-align: center;
  padding: 20px 12px;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border-light);
}

.stat-number {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

/* Score bars */

.score-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.score-label {
  width: 80px;
  font-size: 0.8125rem;
  font-weight: 500;
  text-align: right;
  flex-shrink: 0;
}

.score-bar-bg {
  flex: 1;
  height: 24px;
  background: var(--bg-secondary);
  border-radius: 6px;
  overflow: hidden;
}

.score-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
}

.score-value {
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
}

/* Image gallery */

.image-gallery {
  display: flex;
  gap: 12px;
  margin: 24px 0;
  overflow-x: auto;
  padding-bottom: 8px;
}

.image-gallery img {
  height: 400px;
  width: auto;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  flex-shrink: 0;
}

.image-placeholder {
  height: 300px;
  background: var(--bg-secondary);
  border: 2px dashed var(--border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 0.875rem;
  margin: 24px 0;
}

/* ─── SUMMARY ─── */

.summary {
  padding: 60px 24px 80px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.summary h2 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 28px;
}

.pipeline-recap {
  position: relative;
  padding-left: 28px;
}

.pipeline-recap::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--border-light);
}

.pipeline-node {
  position: relative;
  margin-bottom: 20px;
  padding-left: 20px;
}

.pipeline-node::before {
  content: '';
  position: absolute;
  left: -22px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid white;
  box-shadow: 0 0 0 2px var(--accent);
}

.pipeline-node .node-title {
  font-weight: 600;
  font-size: 0.9375rem;
}

.pipeline-node .node-detail {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

/* ─── FOOTER ─── */

.site-footer {
  padding: 40px 24px;
  text-align: center;
  border-top: 1px solid var(--border-light);
  color: var(--text-tertiary);
  font-size: 0.8125rem;
}

/* ─── DOC PAGES — Breadcrumb ─── */

.breadcrumb {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 20px 24px;
}

.breadcrumb a {
  font-size: 0.875rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

/* ─── DOC PAGES — Markdown Body (GitHub-flavored) ─── */

.markdown-body {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 0 24px 80px;
  font-size: 1rem;
  line-height: 1.7;
}

.markdown-body h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 24px;
}

.markdown-body h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 40px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.markdown-body h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 12px;
}

.markdown-body h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 24px;
  margin-bottom: 8px;
}

.markdown-body p {
  margin-bottom: 16px;
}

.markdown-body ul, .markdown-body ol {
  margin-bottom: 16px;
  padding-left: 28px;
}

.markdown-body li {
  margin-bottom: 4px;
}

.markdown-body li > ul, .markdown-body li > ol {
  margin-top: 4px;
  margin-bottom: 4px;
}

.markdown-body blockquote {
  border-left: 4px solid var(--border);
  padding: 8px 16px;
  margin: 0 0 16px 0;
  color: var(--text-secondary);
}

.markdown-body blockquote p:last-child {
  margin-bottom: 0;
}

.markdown-body code {
  font-family: "SF Mono", "Menlo", "Monaco", "Courier New", monospace;
  font-size: 0.875em;
  background: var(--bg-code);
  padding: 2px 6px;
  border-radius: 4px;
}

.markdown-body pre {
  background: var(--bg-code);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  margin-bottom: 16px;
}

.markdown-body pre code {
  background: none;
  padding: 0;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
  font-size: 0.875rem;
}

.markdown-body th {
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  background: var(--bg-secondary);
}

.markdown-body td {
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  vertical-align: top;
}

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 32px 0;
}

.markdown-body img {
  max-width: 100%;
  border-radius: 8px;
}

.markdown-body a {
  color: var(--link);
  text-decoration: none;
}

.markdown-body a:hover {
  text-decoration: underline;
}

.markdown-body strong {
  font-weight: 600;
}

.markdown-body .task-list-item {
  list-style: none;
  margin-left: -24px;
}

.markdown-body input[type="checkbox"] {
  margin-right: 8px;
}

/* ─── RESPONSIVE ─── */

@media (max-width: 768px) {
  .site-header {
    padding: 48px 20px 40px;
  }

  .site-header h1 {
    font-size: 2rem;
  }

  .site-header .subtitle {
    font-size: 1.0625rem;
  }

  .stage {
    padding: 40px 20px;
  }

  .stage h2 {
    font-size: 1.375rem;
  }

  .flow {
    flex-direction: column;
  }

  .flow-arrow {
    transform: rotate(90deg);
    justify-content: center;
  }

  .image-gallery img {
    height: 280px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .pipeline-steps {
    flex-direction: column;
    align-items: center;
  }

  .pipeline-step .arrow {
    transform: rotate(90deg);
  }

  .markdown-body {
    padding: 0 20px 60px;
  }
}

@media (max-width: 480px) {
  .site-header h1 {
    font-size: 1.625rem;
  }

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

  .image-gallery img {
    height: 220px;
  }
}
