/* /agentic-erp/ · the Kernel chapter as a row of machines, one per AI model (Saife 2026-10-19: "center this and add
   mechanics motion graphics so it looks like a machine for each model"; the brain once drawn round the gears was removed:
   "remove the brain completely leave just the gear wheels"). Markup from build.py mill(); the motion is
   pages/erp/mill.js. Same glass and violet edge as the catalogue's panels, lit at rest (critique log 2026-10-10). */

/* the chapter holds its copy centred at the top and the machines below, as the Workspace chapter does */
.erp .erpch--mill { height: auto; min-height: 100svh; padding: clamp(110px, 16vh, 170px) 0 clamp(80px, 12vh, 130px); }
.erp .erpch--mill .lh__copy { position: relative; left: auto; right: auto; bottom: auto; margin: 0 auto; max-width: min(900px, 86vw); text-align: center; }
.erp .erpch--mill .lh__h { font-size: clamp(38px, 4.6vw, 72px); text-wrap: balance; }
.erp .erpch--mill .lh__sub { max-width: 56ch; margin-inline: auto; }
.erp .erpch--mill .lh__scrim { background: radial-gradient(46% 30% at 50% 16%, rgb(10 8 20 / .6), rgb(10 8 20 / .2) 55%, transparent 76%); }

.mill { position: relative; z-index: 5; width: min(1120px, calc(100% - 2 * clamp(20px, 7vw, 120px))); margin: clamp(56px, 7vw, 96px) auto 0; }
.mill__row { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(14px, 2vw, 28px); }

/* a machine: an opaque housing, so the shafts drawn behind never show through it */
.mill__m { position: relative; padding: 14px 14px 12px; border-radius: 18px;
  background: linear-gradient(180deg, rgb(26 20 52 / .96), rgb(14 11 30 / .97)), #0d0a1c;
  border: 1px solid rgb(154 107 255 / .42); box-shadow: 0 0 40px -16px rgb(154 107 255 / .7), inset 0 1px 0 rgb(220 205 255 / .12);
  transition: border-color .5s, box-shadow .5s, opacity .6s; }
.mill__m.is-on { border-color: rgb(196 170 255 / .9); box-shadow: 0 0 0 1px rgb(154 107 255 / .3), 0 0 70px -8px rgb(154 107 255 / .95), inset 0 1px 0 rgb(230 220 255 / .22); }
.mill__lamp { position: absolute; top: 14px; right: 14px; width: 8px; height: 8px; border-radius: 50%; background: #3a2d68; transition: background .4s, box-shadow .4s; }
.mill__m.is-on .mill__lamp { background: #e3d6ff; box-shadow: 0 0 10px #b89bff, 0 0 18px #9a6bff; }

.mill__mech { display: block; width: 100%; height: auto; overflow: visible; }
/* the gear wheels: a toothed body lit from its own axle (build.py gear_svg), an inner rim line and a hub ring */
.mill__w { stroke: rgb(217 201 255 / .55); stroke-width: .9; stroke-linejoin: round; transition: filter .5s; }
.mill__rim { fill: none; stroke: rgb(20 14 44 / .55); stroke-width: 1.4; }
.mill__ring { fill: none; stroke: #c9b3ff; stroke-width: 1.6; opacity: .8; }
.mill__m.is-on .mill__w { filter: brightness(1.18); }
.mill__m.is-on .mill__mech { filter: drop-shadow(0 0 7px rgb(154 107 255 / .6)); }

/* the nameplate sits below the moving parts, never over them */
.mill__plate { display: flex; align-items: center; gap: 10px; margin: 10px 0 0; padding-top: 12px; border-top: 1px solid rgb(154 107 255 / .2); }
.mill__logo { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: #f1edfa; box-shadow: 0 0 14px rgb(154 107 255 / .35); }
.mill__logo img, .mill__logo svg { width: 20px; height: 20px; }
.mill__plate b { display: block; font: 600 15px/1.2 var(--sc-font-display); letter-spacing: -.01em; color: #f4f3ef; }
.mill__plate small { display: block; margin-top: 2px; font-size: 12.5px; color: #a99ad6; }

/* the shafts: from each machine's foot down to one drive line and into the core, drawn behind the housings (mill.js) */
.mill__wires { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 0; }
.mill__wires path { fill: none; stroke: rgb(154 107 255 / .32); stroke-width: 2; }
.mill__wires .on { stroke: rgb(196 170 255 / .8); }
.mill__wires .run { stroke: #efe6ff; stroke-width: 2.6; stroke-linecap: round; stroke-dasharray: 10 22; filter: drop-shadow(0 0 5px #b89bff); animation: millRun 1.1s linear infinite; }
@keyframes millRun { from { stroke-dashoffset: 32; } to { stroke-dashoffset: 0; } }

/* the TagFlow core: the octopus alone (Saife 2026-10-19: "no gear wheel just the octopus"), bobbing gently the whole
   time, so it is still visibly running when the AI is off */
.mill__core { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; margin: clamp(56px, 6vw, 80px) auto 0; text-align: center; }
.mill__core img { width: 72px; height: auto; filter: drop-shadow(0 0 16px rgb(154 107 255 / .75)); animation: millBob 3.2s ease-in-out infinite; }
@keyframes millBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.mill__core p { margin: 14px 0 0; }
.mill__core b { display: block; font: 600 16px/1.2 var(--sc-font-display); color: #f4f3ef; }
.mill__say { display: block; margin-top: 4px; min-height: 1.4em; font-size: 14px; color: #c9bdf0; transition: opacity .3s; }

/* AI switched off: every machine winds down and dims a little; the core keeps turning */
.mill.is-ai-off .mill__m { opacity: .62; }

@media (prefers-reduced-motion: reduce) { .mill__core img { animation: none; } }
@media (max-width: 760px) {
  .mill__row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mill__wires { display: none; }
  .mill__core { margin-top: 28px; }
  .mill__plate b { font-size: 14px; }
}
