/* ============================================================
   Agentic AI Masterclass — shared design system
   Dark, glassy, animated. Used by index + all 11 lab pages.
   ============================================================ */

:root {
  --bg:        #07070f;
  --bg-2:      #0d0d1f;
  --panel:     rgba(255,255,255,0.035);
  --panel-2:   rgba(255,255,255,0.06);
  --border:    rgba(255,255,255,0.09);
  --border-2:  rgba(255,255,255,0.16);
  --ink:       #ececf7;
  --muted:     #9494bd;
  --faint:     #6a6a8e;

  --accent:    #7c6cff;   /* indigo  — agents / brand        */
  --search:    #38bdf8;   /* cyan    — search / data         */
  --calc:      #34d399;   /* green   — calc / done / result  */
  --plan:      #fbbf24;   /* amber   — plan / delegate       */
  --write:     #f472b6;   /* magenta — write / edit          */
  --read:      #60a5fa;   /* blue    — read                  */
  --error:     #f87171;   /* red                              */

  --radius: 16px;
  --mono: "SF Mono", "JetBrains Mono", "Fira Code", ui-monospace, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --maxw: 1080px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1100px 600px at 12% -8%, rgba(124,108,255,0.20), transparent 60%),
    radial-gradient(900px 540px at 100% 0%, rgba(56,189,248,0.12), transparent 55%),
    radial-gradient(800px 800px at 50% 120%, rgba(244,114,182,0.08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
::selection { background: rgba(124,108,255,0.35); }

/* ── Top bar ─────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 18px;
  padding: 12px 22px;
  background: rgba(7,7,15,0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar .brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 15px; letter-spacing: 0.2px;
}
.topbar .brand .dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 16px var(--accent);
}
.topbar .spacer { flex: 1; }
.topbar .nav-link {
  font-size: 13px; color: var(--muted); padding: 7px 13px;
  border-radius: 9px; border: 1px solid transparent; transition: .18s;
}
.topbar .nav-link:hover { color: #fff; background: var(--panel-2); border-color: var(--border); }
.topbar .nav-link.disabled { opacity: 0.3; pointer-events: none; }

/* progress rail under topbar */
.progress-rail { height: 2px; background: transparent; }
.progress-rail > i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--search));
}

/* ── Layout shell ────────────────────────────────────────── */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }
section.block { padding: 46px 0; }

/* ── Hero (lab page) ─────────────────────────────────────── */
.lab-hero { padding: 54px 0 18px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 12px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--muted);
}
.lab-tag {
  font-family: var(--mono); font-size: 12px; font-weight: 700;
  color: #fff; background: var(--accent); padding: 3px 10px; border-radius: 7px;
  box-shadow: 0 6px 22px rgba(124,108,255,0.4);
}
.lab-hero h1 {
  font-size: clamp(30px, 5vw, 50px); font-weight: 850; line-height: 1.04;
  margin: 16px 0 12px; letter-spacing: -1px;
}
.lab-hero .goal { font-size: 18px; color: var(--muted); max-width: 720px; }
.gradient-text {
  background: linear-gradient(100deg, #fff 10%, var(--accent) 55%, var(--search) 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

/* ── Animation stage ─────────────────────────────────────── */
.stage-card {
  position: relative;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.015));
  border-radius: var(--radius);
  padding: 26px;
  margin-top: 26px;
  overflow: hidden;
}
.stage-card::before {            /* subtle grid texture */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 34px 34px;
  -webkit-mask-image: radial-gradient(circle at 50% 40%, black, transparent 78%);
          mask-image: radial-gradient(circle at 50% 40%, black, transparent 78%);
}
.stage-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-bottom: 8px; position: relative; z-index: 2;
}
.stage-head .title { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .4px; }
.replay-btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-family: var(--mono); font-size: 12.5px; font-weight: 600; color: var(--ink);
  background: var(--panel-2); border: 1px solid var(--border-2);
  padding: 7px 14px; border-radius: 10px; transition: .18s;
}
.replay-btn:hover { background: rgba(124,108,255,0.18); border-color: var(--accent); }
.replay-btn svg { width: 14px; height: 14px; }

/* the actual diagram canvas */
.stage {
  position: relative; z-index: 1;
  min-height: 360px;
  display: grid;
}
.stage svg.edges { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 1; }
.edge { stroke: var(--border-2); stroke-width: 2; fill: none; stroke-linecap: round; }
.edge-dash { stroke-dasharray: 5 7; }

/* absolute placement wrapper — keeps node centered on its (left,top) point
   while anime.js animates the inner .node transform freely */
.slot { position: absolute; transform: translate(-50%, -50%); z-index: 2; }
.slot.wide .node { min-width: 150px; }

/* a generic node (agent / tool / file) */
.node {
  position: relative; z-index: 2;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; text-align: center;
  padding: 14px 18px; border-radius: 14px;
  background: var(--panel-2); border: 1px solid var(--border-2);
  min-width: 116px; opacity: 0; /* anime reveals */
  transition: box-shadow .25s, border-color .25s, transform .25s;
}
.node .ico { font-size: 22px; line-height: 1; }
.node .nm  { font-size: 13px; font-weight: 700; }
.node .sub { font-size: 11px; color: var(--muted); font-family: var(--mono); }
.node.orch  { border-color: rgba(124,108,255,.6); }
.node.lit   { box-shadow: 0 0 0 1px currentColor, 0 0 26px -2px currentColor; }
.node.c-accent { color: var(--accent); }
.node.c-search { color: var(--search); }
.node.c-calc   { color: var(--calc); }
.node.c-plan   { color: var(--plan); }
.node.c-write  { color: var(--write); }
.node.c-read   { color: var(--read); }
.node .nm, .node .ico, .node .sub { color: var(--ink); }   /* keep text neutral; glow uses currentColor */

/* travelling packet dot */
.packet {
  position: absolute; z-index: 3; width: 11px; height: 11px; border-radius: 50%;
  background: #fff; opacity: 0; pointer-events: none;
  box-shadow: 0 0 14px 2px currentColor; color: var(--accent);
}

/* small chips / file tokens */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 11.5px; color: var(--ink);
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  border-radius: 8px; padding: 5px 9px; opacity: 0;
}
.chip .d { width: 7px; height: 7px; border-radius: 2px; background: var(--write); }

.legend {
  display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 18px;
  font-size: 11.5px; color: var(--muted); position: relative; z-index: 2;
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* caption beneath stage */
.stage-caption {
  margin-top: 16px; font-size: 13.5px; color: var(--muted);
  position: relative; z-index: 2; min-height: 20px;
}
.stage-caption b { color: var(--ink); font-weight: 700; }

/* ── Content sections ────────────────────────────────────── */
.section-title {
  font-size: 13px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--accent); margin-bottom: 14px;
}
.prose p { color: #cdcde6; margin-bottom: 14px; }
.prose strong { color: #fff; }
.prose ul { margin: 0 0 14px 20px; color: #cdcde6; }
.prose li { margin-bottom: 7px; }
.prose code {
  font-family: var(--mono); font-size: 0.88em; color: #ffd9a8;
  background: rgba(255,255,255,0.06); padding: 1.5px 6px; border-radius: 5px;
}

.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.info-card {
  border: 1px solid var(--border); background: var(--panel); border-radius: 14px;
  padding: 18px 20px;
}
.info-card h4 { font-size: 14px; margin-bottom: 6px; display:flex; align-items:center; gap:8px; }
.info-card p { font-size: 13.5px; color: var(--muted); margin: 0; }

/* ── Code block (mac window) ─────────────────────────────── */
.code {
  border: 1px solid var(--border); border-radius: 14px; overflow: hidden;
  background: #0a0a18; margin: 6px 0 4px;
}
.code .bar {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  background: rgba(255,255,255,0.03); border-bottom: 1px solid var(--border);
}
.code .bar .dots { display: flex; gap: 6px; }
.code .bar .dots i { width: 11px; height: 11px; border-radius: 50%; }
.code .bar .dots i:nth-child(1){ background:#ff5f56; }
.code .bar .dots i:nth-child(2){ background:#ffbd2e; }
.code .bar .dots i:nth-child(3){ background:#27c93f; }
.code .bar .fn { font-family: var(--mono); font-size: 12px; color: var(--faint); margin-left: 6px; }
.code pre {
  margin: 0; padding: 16px 18px; overflow-x: auto;
  font-family: var(--mono); font-size: 12.7px; line-height: 1.65; color: #d6d6ef;
  tab-size: 2;
}
.code pre .c  { color: #6a6a8e; font-style: italic; }   /* comment */
.code pre .k  { color: #c792ea; }                         /* keyword */
.code pre .s  { color: #c3e88d; }                         /* string  */
.code pre .f  { color: #82aaff; }                         /* func / name */
.code pre .n  { color: #f78c6c; }                         /* number  */
.code pre .d  { color: #ffcb6b; }                         /* decorator */

/* ── Learn table ─────────────────────────────────────────── */
.learn-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.learn-table th, .learn-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.learn-table th { color: var(--accent); font-size: 11.5px; text-transform: uppercase; letter-spacing: 1px; }
.learn-table td:first-child { font-family: var(--mono); color: #ffd9a8; white-space: nowrap; }
.learn-table tr:hover td { background: rgba(255,255,255,0.02); }

/* ── Pager (bottom prev/next) ────────────────────────────── */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 30px 0 70px; }
.pager a {
  border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px;
  background: var(--panel); transition: .2s; display: block;
}
.pager a:hover { border-color: var(--accent); background: rgba(124,108,255,0.10); transform: translateY(-2px); }
.pager .dir { font-size: 12px; color: var(--muted); font-weight: 700; letter-spacing: .5px; }
.pager .ttl { font-size: 16px; font-weight: 750; margin-top: 4px; }
.pager a.next { text-align: right; }
.pager a.empty { opacity: .35; pointer-events: none; }

/* ── Run command callout ─────────────────────────────────── */
.runbox {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  border: 1px solid var(--calc); background: rgba(52,211,153,0.08);
  border-radius: 14px; padding: 16px 20px; margin-top: 6px;
}
.runbox .lbl { font-size: 12px; font-weight: 800; letter-spacing: 1px; color: var(--calc); text-transform: uppercase; }
.runbox code { font-family: var(--mono); font-size: 14px; color: #d9ffe9; }

/* ── Copy-paste prompt box (shared) ──────────────────────── */
.prompt-box { position: relative; border: 1px solid var(--border-2); border-radius: 13px; background: #0a0a18; overflow: hidden; }
.prompt-box .ph { display: flex; align-items: center; justify-content: space-between; gap: 10px;
                  padding: 9px 14px; background: rgba(124,108,255,0.12); border-bottom: 1px solid var(--border); }
.prompt-box .ph .t { font-family: var(--mono); font-size: 12px; color: var(--accent); font-weight: 700; letter-spacing: .4px; }
.copy-btn { cursor: pointer; font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--ink);
            background: var(--panel-2); border: 1px solid var(--border-2); padding: 5px 11px; border-radius: 8px; transition: .18s; }
.copy-btn:hover { background: rgba(124,108,255,0.2); border-color: var(--accent); }
.copy-btn.done { background: rgba(52,211,153,0.2); border-color: var(--calc); color: #d9ffe9; }
.prompt-box pre { margin: 0; padding: 15px 16px; font-family: var(--mono); font-size: 12.6px; line-height: 1.6;
                  color: #cfcfe8; white-space: pre-wrap; overflow: auto; max-height: 380px; }

/* ── Folder structure tree ───────────────────────────────── */
.tree { border: 1px solid var(--border); border-radius: 13px; background: #0a0a18; padding: 16px 18px; overflow-x: auto; }
.tree pre { margin: 0; font-family: var(--mono); font-size: 12.8px; line-height: 1.85; color: #b9b9d6; white-space: pre; }
.tree .hl  { color: var(--calc); font-weight: 700; }            /* the build target */
.tree .cm  { color: var(--faint); }                             /* trailing comment */
.tree .dir { color: var(--search); }
.tree .badge { display:inline-block; font-size:10px; font-weight:700; color:#03210f; background:var(--calc);
               border-radius:5px; padding:0 6px; margin-left:6px; vertical-align:middle; }

/* ── Build-with-agent injected section ───────────────────── */
.build-files { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.build-files .chip2 { font-family: var(--mono); font-size: 12px; color: #d9ffe9; background: rgba(52,211,153,0.10);
                      border: 1px solid rgba(52,211,153,0.4); border-radius: 8px; padding: 5px 10px; }
.minilink { color: var(--search); font-size: 13.5px; }
.minilink:hover { text-decoration: underline; }

/* ── Reference-docs grid (start.html) ────────────────────── */
.doc-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); }
.doc-card { border: 1px solid var(--border); background: var(--panel); border-radius: 13px; padding: 16px 18px; transition: .2s; display:block; }
.doc-card:hover { border-color: var(--accent); background: rgba(124,108,255,0.08); transform: translateY(-2px); }
.doc-card .fn { font-family: var(--mono); font-size: 12px; color: var(--accent); }
.doc-card h4 { font-size: 15px; margin: 5px 0 5px; }
.doc-card p { font-size: 13px; color: var(--muted); margin: 0; }

/* ── Footer ──────────────────────────────────────────────── */
.foot { border-top: 1px solid var(--border); padding: 28px 0 60px; color: var(--faint); font-size: 13px; text-align: center; }
.foot a { color: var(--muted); }
.foot a:hover { color: #fff; }

/* reveal-on-scroll baseline */
.reveal { opacity: 0; transform: translateY(22px); }

@media (max-width: 720px) {
  .pager { grid-template-columns: 1fr; }
  .topbar .nav-link.hide-sm { display: none; }
}
