/* Neural Networks and Transformers: the figures on its slides. Boxes, chips,
   tables and the shared colours are in ../llmops.css. */

/* The map of AI. */
.am { stroke-width: 2; }
.am.a0 { fill: #f5f7fa; stroke: #94a3b8; }
.am.a1 { fill: #eef6fb; stroke: var(--code); }
.am.a2 { fill: #f3effd; stroke: #8b5cf6; }
.am.a3 { fill: #e9dffd; stroke: var(--model); stroke-width: 3; }

/* Neurons. */
.n-in { fill: #effaf5; stroke: var(--data); stroke-width: 2; }
.n-cell { fill: #f7f3ff; stroke: var(--model); stroke-width: 2.4; }
.n-act { fill: #fff; stroke: var(--model); stroke-width: 2; }
.n-w { font: 600 13px var(--mono); fill: var(--model); }

/* Training. */
.tr { display: flex; flex-direction: column; gap: 14px; }
.tr-back { align-self: center; font-size: 15px; color: var(--model); border: 1.5px dashed var(--model); border-radius: 20px; padding: 6px 16px; background: #fff; }

/* Tokens. */
.tk { display: flex; flex-direction: column; gap: 18px; align-items: flex-start; }
.tk-text { font-size: 24px; font-weight: 600; }
.tk-row { display: flex; gap: 8px; flex-wrap: wrap; }
.tk-row .chip { font-size: 16px; padding: 5px 12px; min-width: 64px; text-align: center; }
.tk-legend { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--sv-ink2); }

/* Embeddings. */
.em-g1 { fill: var(--code); } .em-g2 { fill: var(--no); } .em-g3 { fill: var(--data); }

/* Attention. */
.at-arc { fill: none; stroke: var(--model); stroke-opacity: .75; stroke-linecap: round; }
.at-w { font: 600 12.5px var(--mono); fill: var(--model); }
.at-t { fill: #fff; stroke: var(--sv-line); stroke-width: 1.5; }
.at-q { fill: #f1eafe; stroke: var(--model); stroke-width: 2.5; }

/* The transformer. */
.tf { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: center; }
.tf-stack { display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.tf-block { position: relative; display: flex; flex-direction: column; gap: 6px; border: 2px solid var(--model); border-radius: 12px; padding: 10px 52px 10px 10px; background: #f7f3ff; }
.tf-x { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 700 18px var(--mono); color: var(--model); }
.tf-bars { width: 100%; height: auto; }
.tf-bar { fill: #c4b5fd; } .tf-bar.top { fill: var(--model); }

/* Generation. */
.gn { display: flex; flex-direction: column; gap: 12px; }
.gn-row { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--sv-line); border-radius: 8px; padding: 8px 12px; font-size: 16px; flex-wrap: wrap; }
.gn-n { font-weight: 700; color: var(--model); }
.gn-ctx { font-family: var(--mono); font-size: 14.5px; }
.gn-row .chip { font-size: 15px; }
.gn-note { font-size: 14px; color: var(--sv-ink2); }

/* The chapter's map. */
.tbl.ops td:last-child { white-space: nowrap; }

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

/* Other types of models: tiles (an icon over its name), a model box, arrows. */
.io { display: flex; flex-direction: column; gap: 14px; }
.io-row { display: flex; align-items: center; gap: 12px; }
.io-ts { display: flex; gap: 8px; flex-wrap: wrap; }
.io-t { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 64px; padding: 6px 4px 4px; background: #fff; border: 1.5px solid var(--c); border-radius: 10px; color: var(--c); font-size: 12.5px; font-weight: 600; flex: none; }
.io-t svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.io-t svg .f { fill: currentColor; stroke: none; }
.io-t.text { --c: var(--code); } .io-t.image { --c: var(--data); } .io-t.voice { --c: var(--tool); }
.io-t.video { --c: var(--user); } .io-t.vector { --c: var(--ops); }
.io-ar { font-size: 26px; line-height: 1; color: #545b64; flex: none; }
.io-ar.sm { font-size: 20px; }
.io-m { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 52px; padding: 6px 14px; background: #f7f3ff; border: 2px solid var(--model); border-radius: 10px; font-size: 14.5px; }
.io-m small { font-size: 12.5px; color: var(--sv-ink2); }
.io svg.pic { border-radius: 8px; border: 1px solid var(--sv-line); display: block; }

/* The overview: seven rows on one grid, the model's name in the middle. */
.io-all { gap: 7px; }
.io-all .io-row { display: grid; grid-template-columns: minmax(0, 1fr) 26px 210px 26px minmax(0, 1fr); gap: 10px; }
.io-all .io-row > .io-ts:first-child { justify-content: flex-end; }
.io-all .io-t { width: 58px; padding: 3px 4px 2px; font-size: 11.5px; }
.io-all .io-t svg { width: 26px; height: 26px; }
.io-all .io-m { min-height: 0; padding: 8px 10px; }
.io-hd { font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--sv-ink2); }
.io-hd span:first-child { text-align: right; } .io-hd span:nth-child(3) { text-align: center; }

/* A multimodal LLM. */
.mm { flex-direction: row; align-items: center; gap: 14px; }
.mm-in { display: flex; flex-direction: column; gap: 8px; flex: 1.3 1 0; min-width: 0; }
.mm-shot { flex: 1 1 0; min-width: 0; height: auto; }
.mm-win { fill: #fff; stroke: var(--sv-line); stroke-width: 1.5; } .mm-bar { fill: #e5e7eb; }
.mm-ttl { font-size: 10px; font-weight: 700; fill: #374151; } .mm-ax { font-size: 9.5px; fill: var(--sv-ink2); }
.mm-q, .mm-a, .sp-say { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--sv-line); border-radius: 10px; padding: 8px 12px; font-size: 15px; }
.mm-q p, .mm-a p, .sp-say p { margin: 0; }
.mm-a { flex: 1 1 0; min-width: 0; }
.mm-also { font-size: 14px; color: var(--sv-ink2); }

/* Speech models. */
.io-row.sp > .sp-say, .io-row.iv > .sp-say { flex: 1 1 0; min-width: 0; }
.sp-chain, .iv-diff { display: flex; flex-direction: column; gap: 8px; border: 1.5px dashed var(--model); border-radius: 12px; padding: 10px 12px; background: #fff; }
.sp-chain b, .iv-diff b { font-size: 14px; }
.sp-chain .io-row { gap: 6px; flex-wrap: wrap; justify-content: center; }
.sp-chain .io-m { padding: 6px 8px; font-size: 13px; } .sp-chain .io-ar { font-size: 20px; }
.sp-chain .io-t { width: 54px; } .sp-chain .io-t svg { width: 28px; height: 28px; }

/* Image and video generation. */
.iv-out .pic { width: 150px; }
.iv-film { display: flex; gap: 4px; padding: 5px; background: #1f2937; border-radius: 8px; }
.iv-frame, .iv-step { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; }
.iv-frame .pic { width: 86px; border: 0; border-radius: 3px; } .iv-frame span { color: #e5e7eb; }
.iv-step .pic { width: 96px; } .iv-step span { color: var(--sv-ink2); }
.iv-diff .io-row { justify-content: center; }

/* Embedding models. */
.eb { flex-direction: row; align-items: center; gap: 18px; }
.eb-list { display: flex; flex-direction: column; gap: 10px; flex: 1 1 0; min-width: 0; }
.eb-row { display: flex; align-items: center; gap: 8px; }
.eb-in { width: 132px; flex: none; display: flex; justify-content: flex-end; font-size: 15px; font-weight: 600; text-align: right; }
.eb-in .pic { width: 84px; }
.eb-v { font: 13px var(--mono); background: #fff; border: 1.5px solid var(--c); color: var(--c); border-radius: 8px; padding: 5px 8px; white-space: nowrap; }
.eb-v.g1 { --c: var(--code); } .eb-v.g2 { --c: var(--no); }
.eb-map { flex: 1 1 0; min-width: 0; max-height: 100%; }
.eb-near { fill: none; stroke: var(--code); stroke-width: 1.5; stroke-dasharray: 5 5; }
.eb-nt { font-size: 12.5px; fill: var(--code); font-weight: 600; }

@media (max-width: 860px) {
  .mm, .eb { flex-direction: column; align-items: stretch; }
  .mm > .io-ar, .eb .io-ar { align-self: center; }
  .io-all .io-row { grid-template-columns: minmax(0, 1fr) 16px 120px 16px minmax(0, 1fr); gap: 4px; }
  .io-row.sp, .io-row.iv { flex-wrap: wrap; }
}
