/* ── Reset & Base ── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --font-sans: "Noto Sans", Arial, Helvetica, sans-serif;
  --font-mono: "Noto Sans Mono", "Courier New", monospace;
  --color-bg: #ffffff;
  --color-text: #1a1a1a;
  --color-muted: #555;
  --color-accent: #2563eb;
  --color-accent-light: #dbeafe;
  --color-border: #e5e7eb;
  --color-code-bg: #f8f9fa;
  --color-banner-bg: #fef3c7;
  --color-banner-border: #f59e0b;
  --max-width: 820px;
  --section-gap: 3.5rem;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ── */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

section {
  margin-bottom: var(--section-gap);
}

/* ── Typography ── */
h1 {
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid var(--color-border);
}

h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

p {
  margin-bottom: 1rem;
}

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

a:hover {
  text-decoration: underline;
}

strong {
  font-weight: 600;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--color-code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

pre {
  background: var(--color-code-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1rem;
  font-size: 0.88rem;
  line-height: 1.6;
}

pre code {
  background: none;
  padding: 0;
}

blockquote {
  border-left: 3px solid var(--color-accent);
  padding: 0.5rem 1rem;
  margin: 1rem 0;
  color: var(--color-muted);
  background: var(--color-code-bg);
  border-radius: 0 6px 6px 0;
}

/* ── Hero ── */
.hero {
  text-align: center;
  padding: 4rem 0 2rem;
}

.hero-logo {
  width: 120px;
  height: 120px;
  margin-bottom: 1.25rem;
  border-radius: 24px;
}

.hero .subtitle {
  font-size: 1.15rem;
  color: var(--color-muted);
  max-width: 600px;
  margin: 0.5rem auto 1.5rem;
  line-height: 1.6;
}

.hero .author {
  font-size: 0.95rem;
  color: var(--color-muted);
  margin-bottom: 1.5rem;
}

.hero .author a {
  color: var(--color-text);
  font-weight: 500;
}

/* ── Quick Links ── */
.quick-links {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.quick-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text);
  transition: border-color 0.2s, background 0.2s;
}

.quick-links a:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-light);
  text-decoration: none;
}

.quick-links a svg {
  width: 16px;
  height: 16px;
}

/* ── Development Banner ── */
.dev-banner {
  background: var(--color-banner-bg);
  border: 1px solid var(--color-banner-border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 2.5rem;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.6;
}

.dev-banner strong {
  color: #92400e;
}

/* ── Table of Contents ── */
.toc {
  position: sticky;
  top: 1.5rem;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
}

.toc-wrapper {
  display: none;
}

@media (min-width: 1200px) {
  .toc-wrapper {
    display: block;
    position: fixed;
    left: max(1rem, calc((100vw - var(--max-width)) / 2 - 220px));
    top: 2rem;
    width: 190px;
    z-index: 10;
  }

  .toc h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-muted);
    margin-bottom: 0.5rem;
  }

  .toc a {
    display: block;
    font-size: 0.82rem;
    color: var(--color-muted);
    padding: 0.2rem 0;
    border-left: 2px solid transparent;
    padding-left: 0.75rem;
    transition: color 0.2s, border-color 0.2s;
    line-height: 1.4;
  }

  .toc a:hover {
    color: var(--color-text);
    text-decoration: none;
  }

  .toc a.active {
    color: var(--color-accent);
    border-left-color: var(--color-accent);
    font-weight: 500;
  }
}

/* ── Pipeline Figure ── */
.pipeline-figure {
  margin: 2rem 0;
  text-align: center;
}

.pipeline-figure img {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.pipeline-figure figcaption {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--color-muted);
  font-style: italic;
}

/* ── Core Principles Cards ── */
.core-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin: 1.5rem 0;
}

@media (max-width: 768px) {
  .core-grid {
    grid-template-columns: 1fr;
  }
}

.core-card {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1.25rem;
  border-top: 3px solid var(--color-text);
}

.core-card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
}

.core-card > p {
  font-size: 0.9rem;
  color: var(--color-muted);
  line-height: 1.55;
  margin-bottom: 0.75rem;
}

.core-details {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--color-border);
  padding-top: 0.65rem;
}

.core-details li {
  font-size: 0.84rem;
  color: var(--color-muted);
  line-height: 1.5;
  margin-bottom: 0.5rem;
  padding-left: 0.75rem;
  position: relative;
}

.core-details li::before {
  content: "\2022";
  position: absolute;
  left: 0;
  color: var(--color-text);
}

.core-details li em {
  color: var(--color-text);
  font-style: italic;
}

/* ── Feature Cards ── */
.features-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.feature-card {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1.25rem;
  transition: border-color 0.2s;
}

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

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

.feature-card p {
  font-size: 0.9rem;
  color: var(--color-muted);
  margin-bottom: 0;
  line-height: 1.5;
}

/* ── Tables ── */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
  font-size: 0.9rem;
}

th,
td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
}

th {
  font-weight: 600;
  background: var(--color-code-bg);
  font-size: 0.85rem;
}

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

/* ── Pipeline Stages ── */
.pipeline-text {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
  background: var(--color-code-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  overflow-x: auto;
  white-space: pre;
}

/* ── Modes ── */
.modes-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}

.mode-card {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1.25rem;
  text-align: center;
}

.mode-card h3 {
  margin-bottom: 0.3rem;
}

.mode-card .mode-scope {
  font-size: 0.82rem;
  color: var(--color-muted);
  margin-bottom: 0.5rem;
}

.mode-card p {
  font-size: 0.88rem;
  margin-bottom: 0;
}

.mode-card.mode-researcher {
  border-top: 3px solid #8b5cf6;
}

.mode-card.mode-engineer {
  border-top: 3px solid var(--color-accent);
}

.mode-card.mode-debugger {
  border-top: 3px solid #dc2626;
}

.mode-card.mode-trainer {
  border-top: 3px solid #10b981;
}

/* ── Install ── */
.install-steps {
  counter-reset: step;
}

.install-step {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
  align-items: flex-start;
}

.install-step::before {
  counter-increment: step;
  content: counter(step);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  background: var(--color-accent);
  color: #fff;
  border-radius: 50%;
  font-weight: 600;
  font-size: 0.85rem;
  margin-top: 0.15rem;
}

.install-step div {
  flex: 1;
}

.install-step p {
  margin-bottom: 0.4rem;
}

/* ── Acknowledgments List ── */
.ack-list {
  list-style: none;
  padding: 0;
}

.ack-list li {
  margin-bottom: 0.75rem;
  padding-left: 1.25rem;
  position: relative;
  font-size: 0.92rem;
  line-height: 1.6;
}

.ack-list li::before {
  content: "\2022";
  position: absolute;
  left: 0;
  color: var(--color-accent);
  font-weight: bold;
}

/* ── Terminal Demos ── */
.demo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 1.5rem 0;
}

@media (max-width: 900px) {
  .demo-grid {
    grid-template-columns: 1fr;
  }
}

.terminal-demo {
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

.term-header {
  background: #2d2d2d;
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.term-dots {
  display: flex;
  gap: 6px;
}

.term-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.term-dots span:nth-child(1) { background: #ff5f57; }
.term-dots span:nth-child(2) { background: #febc2e; }
.term-dots span:nth-child(3) { background: #28c840; }

.term-title {
  flex: 1;
  text-align: center;
  font-size: 0.75rem;
  color: #999;
  font-family: var(--font-mono);
}

.demo-replay {
  background: none;
  border: 1px solid #555;
  color: #999;
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-mono);
  transition: color 0.2s, border-color 0.2s;
}

.demo-replay:hover {
  color: #fff;
  border-color: #999;
}

.term-body {
  background: #1a1a1a;
  padding: 0.75rem 1rem;
  min-height: 280px;
  max-height: 380px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.55;
}

.term-body::-webkit-scrollbar {
  width: 4px;
}

.term-body::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 2px;
}

.term-line {
  white-space: pre-wrap;
  word-break: break-word;
}

.term-user {
  color: #e2e8f0;
}

.term-prompt {
  color: #10b981;
  font-weight: 600;
}

.term-typed {
  color: #f1f5f9;
}

.term-output {
  color: #94a3b8;
}

.term-output.term-accent {
  color: #60a5fa;
  font-weight: 600;
}

.term-output.term-dim {
  color: #64748b;
  font-style: italic;
}

.term-output.term-box {
  color: #fbbf24;
  font-size: 0.72rem;
  line-height: 1.4;
}

.term-cursor {
  color: #10b981;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ── Footer ── */
footer {
  border-top: 1px solid var(--color-border);
  padding: 2rem 0;
  margin-top: 3rem;
  text-align: center;
  color: var(--color-muted);
  font-size: 0.85rem;
}

footer a {
  color: var(--color-muted);
}

footer a:hover {
  color: var(--color-accent);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  h1 {
    font-size: 1.8rem;
  }

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

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

  .hero {
    padding: 2.5rem 0 1.5rem;
  }
}

/* ── Live Scenarios ── */
.scenario-card {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  margin-bottom: 1.75rem;
  overflow: hidden;
  transition: border-color 0.2s;
}

.scenario-card:hover {
  border-color: #bbb;
}

.scenario-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.scenario-header.scenario-engineer { background: #eff6ff; }
.scenario-header.scenario-researcher { background: #f5f3ff; }
.scenario-header.scenario-debugger { background: #fef2f2; }

.scenario-number {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
  color: #fff;
}

.scenario-engineer .scenario-number { background: #2563eb; }
.scenario-researcher .scenario-number { background: #8b5cf6; }
.scenario-debugger .scenario-number { background: #dc2626; }

.scenario-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  line-height: 1.35;
}

.scenario-desc {
  font-size: 0.9rem;
  color: var(--color-muted);
  margin-bottom: 0;
  line-height: 1.5;
}

.scenario-body {
  padding: 1.25rem 1.5rem;
}

.scenario-mode {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.scenario-mode .mode-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

.mode-badge.researcher { background: #f5f3ff; color: #8b5cf6; }
.mode-badge.engineer { background: #eff6ff; color: #2563eb; }
.mode-badge.debugger { background: #fef2f2; color: #dc2626; }
.mode-badge.trainer { background: #ecfdf5; color: #10b981; }

.scenario-gates {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #999;
}

.scenario-flow {
  margin-bottom: 1rem;
}

.scenario-step {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.85rem;
  align-items: flex-start;
}

.scenario-step-label {
  min-width: 5.5rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-muted);
  padding-top: 0.15rem;
  flex-shrink: 0;
  text-align: right;
}

.scenario-step-text {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--color-text);
  flex: 1;
}

.scenario-step-text strong {
  color: var(--color-text);
}

.scenario-step-text code {
  font-size: 0.84em;
  background: var(--color-code-bg);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

.scenario-step-text em {
  color: var(--color-muted);
}

.scenario-outcome {
  background: var(--color-code-bg);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--color-muted);
}

.scenario-outcome strong {
  color: var(--color-text);
}

@media (max-width: 768px) {
  .scenario-header {
    padding: 1rem 1.25rem;
  }
  .scenario-body {
    padding: 1rem 1.25rem;
  }
  .scenario-step {
    flex-direction: column;
    gap: 0.2rem;
  }
  .scenario-step-label {
    text-align: left;
  }
}

/* ── Scroll Animations ── */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}
