/* ========================================
   Agentic AI Wiki — Animated Dark Theme
   ======================================== */

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

:root {
  --bg: #0f1117;
  --bg-card: #161922;
  --bg-nav: #12151e;
  --bg-code: #1a1e2e;
  --border: #252a3a;
  --border-hover: #4f7cff;
  --text: #cdd6f4;
  --text-muted: #7f849c;
  --text-bright: #eef1f8;
  --accent: #7c9cff;
  --accent-dim: #4f6ad6;
  --yellow: #e3b341;
  --green: #a6d189;
  --red: #e78284;
  --purple: #b4befe;
  --teal: #94e2d5;
  --peach: #fab387;
  --radius: 10px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--text-bright); }

/* ---- Animations ---- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(124,156,255,0); }
  50% { box-shadow: 0 0 20px 2px rgba(124,156,255,0.15); }
}
@keyframes borderFlow {
  0% { border-color: var(--border); }
  50% { border-color: var(--accent); }
  100% { border-color: var(--border); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes typewriter {
  from { width: 0; }
  to { width: 100%; }
}

.animate-in {
  animation: fadeInUp 0.5s ease-out both;
}
.animate-in:nth-child(2) { animation-delay: 0.05s; }
.animate-in:nth-child(3) { animation-delay: 0.1s; }
.animate-in:nth-child(4) { animation-delay: 0.15s; }
.animate-in:nth-child(5) { animation-delay: 0.2s; }
.animate-in:nth-child(6) { animation-delay: 0.25s; }
.animate-in:nth-child(7) { animation-delay: 0.3s; }
.animate-in:nth-child(8) { animation-delay: 0.35s; }
.animate-in:nth-child(9) { animation-delay: 0.4s; }
.animate-in:nth-child(10) { animation-delay: 0.45s; }

/* ---- Nav ---- */
.nav {
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(18,21,30,0.85);
}
.nav-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 2rem;
}
.nav-brand {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-bright);
  letter-spacing: -0.01em;
  transition: color 0.2s;
}
.nav-brand:hover {
  color: var(--accent);
}
.nav-links {
  list-style: none;
  display: flex;
  gap: 1.25rem;
}
.nav-links a {
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--text-bright);
  border-bottom-color: var(--accent);
}

/* ---- Container ---- */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ---- Breadcrumb ---- */
.breadcrumb {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  animation: slideInLeft 0.4s ease-out;
}
.breadcrumb a { color: var(--text-muted); transition: color 0.15s; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { margin: 0 0.4rem; opacity: 0.5; }

/* ---- Page Header ---- */
.page-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  animation: fadeInUp 0.5s ease-out;
}
.page-header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -0.02em;
  margin-bottom: 0.3rem;
}
.page-header .tagline {
  font-size: 1rem;
  color: var(--text-muted);
}

/* ---- Sections ---- */
section {
  margin-bottom: 2.5rem;
  animation: fadeInUp 0.5s ease-out both;
}
section h2 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
section h2::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 1.15rem;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}

p { font-size: 0.93rem; margin-bottom: 0.75rem; }
p:last-child { margin-bottom: 0; }

ul, ol { padding-left: 1.3rem; margin-bottom: 0.75rem; }
li { margin-bottom: 0.3rem; font-size: 0.93rem; }
li strong { color: var(--text-bright); }

/* ---- Inline code ---- */
code {
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 0.85em;
}
:not(pre) > code {
  background: var(--bg-code);
  padding: 0.15em 0.45em;
  border-radius: 5px;
  color: var(--accent);
  border: 1px solid var(--border);
  transition: background 0.15s, border-color 0.15s;
}
:not(pre) > code:hover {
  background: #1e2336;
  border-color: var(--accent);
}

/* ---- Code blocks ---- */
pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1rem;
  font-size: 0.84rem;
  line-height: 1.6;
  transition: border-color 0.2s, box-shadow 0.2s;
  position: relative;
}
pre:hover {
  border-color: #353b50;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}
pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
}

/* ---- Tables ---- */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
th {
  text-align: left;
  padding: 0.6rem 0.8rem;
  background: var(--bg-code);
  color: var(--text-bright);
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}
td {
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  transition: background 0.15s;
}
tr:hover td {
  background: rgba(124,156,255,0.03);
}
tr:last-child td { border-bottom: none; }

/* ---- Callout boxes ---- */
.callout {
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  border-left: 3px solid;
  transition: transform 0.15s, box-shadow 0.15s;
}
.callout:hover {
  transform: translateX(3px);
}
.callout.tip {
  background: #111b2e;
  border-color: var(--accent);
  color: var(--text);
}
.callout.warning {
  background: #1b1a10;
  border-color: var(--yellow);
  color: var(--text);
}
.callout strong { color: var(--text-bright); }

/* ---- File tree ---- */
.file-tree {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.8;
}
.file-tree .dir { color: var(--accent); font-weight: 600; }
.file-tree .file { color: var(--green); }

/* ---- Related concepts grid ---- */
.related-concepts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.6rem;
}
.related-concepts a {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 1rem;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.related-concepts a:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(124,156,255,0.1);
  text-decoration: none;
  color: var(--accent);
}

/* ---- Concept cards (homepage + index) ---- */
.concept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.75rem;
}
.concept-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  color: var(--text);
  transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
  position: relative;
  overflow: hidden;
}
.concept-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--purple), var(--teal));
  opacity: 0;
  transition: opacity 0.25s;
}
.concept-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(124,156,255,0.08);
  text-decoration: none;
}
.concept-card:hover::before {
  opacity: 1;
}
.concept-card h3 {
  color: var(--accent);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  transition: color 0.15s;
}
.concept-card:hover h3 {
  color: var(--text-bright);
}
.concept-card p {
  color: var(--text-muted);
  font-size: 0.83rem;
  margin: 0;
  line-height: 1.5;
}

/* ---- Homepage hero ---- */
.hero {
  text-align: center;
  padding: 3.5rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
  animation: fadeIn 0.6s ease-out;
}
.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-bright);
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--text-bright), var(--accent), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero .subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ---- Section titles ---- */
.section-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 1rem;
}

/* ---- Index header ---- */
.index-header {
  margin-bottom: 2rem;
}
.index-header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -0.02em;
}
.index-header p {
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* ---- Visual Diagram Boxes ---- */
.diagram {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
}
.diagram-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}
.diagram svg {
  width: 100%;
  height: auto;
}

/* ---- Flow diagram (CSS-based) ---- */
.flow {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
  justify-content: center;
  padding: 1rem 0;
}
.flow-node {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-bright);
  white-space: nowrap;
  transition: border-color 0.2s, transform 0.2s;
}
.flow-node:hover {
  border-color: var(--accent);
  transform: scale(1.05);
}
.flow-node.accent {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(124,156,255,0.08);
}
.flow-node.green {
  border-color: var(--green);
  color: var(--green);
  background: rgba(166,209,137,0.08);
}
.flow-node.yellow {
  border-color: var(--yellow);
  color: var(--yellow);
  background: rgba(227,179,65,0.08);
}
.flow-node.purple {
  border-color: var(--purple);
  color: var(--purple);
  background: rgba(180,190,254,0.08);
}
.flow-arrow {
  color: var(--text-muted);
  font-size: 1.1rem;
  padding: 0 0.4rem;
  flex-shrink: 0;
}

/* ---- Badge / Tag ---- */
.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15em 0.55em;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
}
.badge.primary { background: rgba(124,156,255,0.15); color: var(--accent); }
.badge.green { background: rgba(166,209,137,0.15); color: var(--green); }
.badge.yellow { background: rgba(227,179,65,0.15); color: var(--yellow); }
.badge.purple { background: rgba(180,190,254,0.15); color: var(--purple); }
.badge.red { background: rgba(231,130,132,0.15); color: var(--red); }
.badge.teal { background: rgba(148,226,213,0.15); color: var(--teal); }

/* ---- Architecture box ---- */
.arch-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}
.arch-box h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.arch-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.arch-row:last-child { margin-bottom: 0; }
.arch-item {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  color: var(--text);
  transition: border-color 0.15s;
}
.arch-item:hover {
  border-color: var(--accent);
}
.arch-item.highlight {
  border-color: var(--accent);
  color: var(--accent);
}
.arch-arrow {
  text-align: center;
  color: var(--text-muted);
  font-size: 1.2rem;
  padding: 0.3rem 0;
}

/* ---- Quick start steps ---- */
.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
}
.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 2.5rem;
  margin-bottom: 1rem;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.1rem;
  width: 1.6rem;
  height: 1.6rem;
  background: var(--accent);
  color: var(--bg);
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* ---- Language Switcher ---- */
.lang-switcher {
  display: flex;
  gap: 0;
  margin-left: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.lang-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
  letter-spacing: 0.02em;
}
.lang-btn:hover {
  color: var(--text-bright);
  background: rgba(124,156,255,0.08);
}
.lang-btn.active {
  color: var(--bg);
  background: var(--accent);
}
.lang-btn + .lang-btn {
  border-left: 1px solid var(--border);
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .nav-inner { padding: 0 1rem; gap: 1rem; }
  .container { padding: 1.25rem 1rem 3rem; }
  .hero h1 { font-size: 1.8rem; }
  .page-header h1 { font-size: 1.5rem; }
  .concept-grid { grid-template-columns: 1fr; }
  .related-concepts { grid-template-columns: 1fr 1fr; }
  pre { font-size: 0.78rem; padding: 0.75rem 1rem; }
  .flow { gap: 0.25rem; }
  .flow-node { font-size: 0.72rem; padding: 0.35rem 0.6rem; }
  .flow-arrow { font-size: 0.9rem; padding: 0 0.2rem; }
}
