/* =========================================================
   AI WORKFLOW
========================================================= */
.aiw {
  padding: var(--space-section) var(--gutter-x);
  border-top: 1px solid var(--color-border);
}
.aiw .section-head h2 {
  font-family: var(--font-serif-italic);
  font-style: italic;
  font-weight: 400;
  letter-spacing: normal;
}

.aiw-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  max-width: var(--container);
  margin: 0 auto;
  list-style: none;
  align-items: stretch;
}

.aiw-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  overflow: hidden;
  will-change: transform, opacity, background-color;
  transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.35s ease, transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.aiw-card:hover {
  background: var(--color-white);
  border-color: transparent;
  transform: translateY(-4px) scale(1.025);
  box-shadow: 0 22px 44px -24px rgba(20, 30, 60, 0.3);
  position: relative;
  z-index: 1;
}

/* ---- Body copy: aligned flush with the scene / card content edges ---- */
.aiw-body {
  display: grid;
  grid-template-rows: auto auto 1fr;
  padding: 0;
}
.aiw-body h3 {
  margin: 0 0 10px;
  font-family: var(--font-sans);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.04em;
}
.aiw-body h3 .serif-italic { font-family: var(--font-serif-italic); font-size: inherit; font-weight: 400; letter-spacing: normal; }
.aiw-body p { height: 4.2em; margin: 0; font-size: var(--fs-body); line-height: 1.4; color: var(--color-text-muted); opacity: .5; }

.aiw-pills { display: flex; flex-wrap: wrap; align-content: flex-end; align-self: end; gap: 5px; min-height: 94px; margin: 0; padding: 0; list-style: none; width: 100%; }
.aiw-pill { display: inline-flex; align-items: center; gap: 5px; background: #fff; border: 0.5px solid rgba(26, 26, 26, 0.15); padding: 4px 7px; font-size: var(--fs-small); line-height: 1.2; color: #423f39; transition: background 0.25s, color 0.25s, border-color 0.25s; }
.aiw-pill img { width: 13px; height: 13px; flex: 0 0 13px; object-fit: contain; object-position: center; transition: filter .25s ease; }

/* ---- Per-card accent palette ---- */
.aiw-card:nth-child(1) { --aiw-accent: #39e673; --aiw-accent-light: #b7f5ca; --aiw-accent-soft: #eafff0; --aiw-neutral: #e7f8ed; --aiw-neutral-strong: #c9efd7; }
.aiw-card:nth-child(2) { --aiw-accent: #e6ac39; --aiw-accent-light: #f6d889; --aiw-accent-soft: #fff7e2; --aiw-neutral: #fff4d5; --aiw-neutral-strong: #f8df9c; }
.aiw-card:nth-child(3) { --aiw-accent: #e63939; --aiw-accent-light: #f3a1a1; --aiw-accent-soft: #fff0f0; --aiw-neutral: #ffe7e7; --aiw-neutral-strong: #f6c2c2; }
.aiw-card:nth-child(4) { --aiw-accent: var(--color-blue); --aiw-accent-light: var(--color-blue-light); --aiw-accent-soft: #eef0ff; --aiw-neutral: #e8ecff; --aiw-neutral-strong: #cbd3ff; }

.aiw-card .aiw-h svg { color: var(--aiw-accent); }
.aiw-card .aiw-h { color: color-mix(in srgb, var(--aiw-accent) 58%, #6d7480); }
.aiw-card .aiw-lv { background: var(--aiw-accent-soft); color: var(--aiw-accent); }
.aiw-card .aiw-lv i { background: var(--aiw-accent); }
.aiw-card .aiw-cu > svg { --cf: var(--aiw-accent); }
.aiw-card .aiw-rp { border-color: var(--aiw-accent); }
.aiw-card .aiw-pl { background: linear-gradient(180deg, rgba(255,255,255,.32), rgba(255,255,255,0) 55%), linear-gradient(180deg, color-mix(in srgb, var(--aiw-accent) 78%, white), var(--aiw-accent)); }
.aiw-card .aiw-cd > svg { --cf: var(--aiw-accent-light); --cs: var(--aiw-accent); }
.aiw-card .aiw-cd .aiw-pl { background: var(--aiw-neutral); color: var(--aiw-accent); border: 1px solid var(--aiw-neutral-strong); box-shadow: 0 2px 0 var(--aiw-neutral-strong), 0 8px 16px -8px color-mix(in srgb, var(--aiw-accent) 28%, transparent); }
.aiw-card .aiw-av { background: linear-gradient(135deg, var(--aiw-accent-soft), var(--aiw-accent-light)); color: var(--aiw-accent); }

@media (max-width: 1100px) { .aiw-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .aiw { padding: 56px var(--gutter-x); }
  .aiw-grid { grid-template-columns: 1fr; }
  .aiw-body h3 { font-size: 20px; }
  .aiw-body p { height: auto; }
  .aiw-pills { min-height: 0; margin-top: 18px; align-content: flex-start; }
  .aiw-pill { gap: 6px; padding: 5px 8px; font-size: 12.5px; }
  .aiw-pill img { width: 14px; height: 14px; flex-basis: 14px; }
  .aiw-card:hover { transform: none; box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) { .aiw-card { transition: none; } .aiw-card:hover { transform: none; } }

/* =========================================================
   Motion scenes — consistent 334x292 app canvas.
   Layout system: 22px outer margin, 12px panel gap,
   14px content inset, 16/10/8 radii, 1px header rules.
   Scaled to the container via --s (set by ai-workflow.js).
========================================================= */
.aiw-sc { position: relative; width: 100%; aspect-ratio: 334 / 292; overflow: hidden; background: transparent; }
.aiw-in { position: absolute; left: 0; top: 0; width: 334px; height: 292px; transform-origin: 0 0; transform: scale(var(--s, 1)); }

/* floating app panels */
.aiw-c { position: absolute; border-radius: 16px; background: linear-gradient(180deg, #fff, #fbfcfe);
  box-shadow: 0 20px 38px -26px rgba(20, 30, 60, .30), 0 4px 10px -6px rgba(20, 30, 60, .06), 0 0 0 1px rgba(178, 188, 202, .24), inset 0 1px 0 #fff;
  animation: aiw-f 6s ease-in-out infinite; }
@keyframes aiw-f { 0%, 100% { translate: 0 0; } 50% { translate: 0 -3px; } }

/* panel header + 1px rule */
.aiw-h { position: absolute; left: 14px; right: 14px; top: 12px; display: flex; align-items: center; gap: 6px; font-size: 11px; line-height: 14px; color: #9096a2; letter-spacing: .01em; }
.aiw-h svg { width: 11px; height: 11px; color: var(--color-blue); }
.aiw-h--chat { color: #2b3038; font-weight: 600; }
.aiw-tbar { position: absolute; left: 0; right: 0; height: 1px; background: rgba(178, 188, 202, .30); }

/* primitives */
.aiw-e { position: absolute; display: block; border-radius: 3px; background: #e7eaf0; }
.aiw-p { fill: none; stroke: #ced4e0; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.aiw-lv { position: absolute; right: 14px; top: 11px; display: flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 10px; background: #eef0ff; color: var(--color-blue); font: 500 10px/12px var(--font-sans); z-index: 4; }
.aiw-lv i { width: 6px; height: 6px; border-radius: 50%; background: var(--color-blue); }
.aiw-caret { position: absolute; width: 2px; height: 13px; border-radius: 1px; background: var(--aiw-accent, var(--color-blue)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--aiw-accent, var(--color-blue)) 16%, transparent); opacity: 0; }

/* ---- real-content text primitives ---- */
.aiw-tx { position: absolute; font: 500 10px/1.3 var(--font-sans); color: #5c6270; white-space: nowrap; }
.aiw-tx b { color: #2b3038; font-weight: 700; }
.aiw-tx.ttl { font-size: 13px; font-weight: 700; color: #23272e; letter-spacing: -0.02em; }
.aiw-tx.mut { color: #9096a2; }
.aiw-tx.mono { font-family: var(--font-mono); font-weight: 500; }

/* chat: user bubble + streamed answer */
.aiw-bub { position: absolute; overflow: hidden; display: flex; align-items: center; padding: 0 11px; border-radius: 12px; background: var(--aiw-accent); color: #fff;
  font: 500 10px/1.3 var(--font-sans); white-space: nowrap; box-shadow: 0 8px 16px -8px color-mix(in srgb, var(--aiw-accent) 70%, transparent); }
.aiw-bub span { display: inline-block; overflow: hidden; white-space: nowrap; will-change: width; }
.aiw-bub--ai { display: block; padding: 7px 12px; background: #f2f4f8; color: #5c6270; box-shadow: inset 0 0 0 1px rgba(178,188,202,.28); }
.aiw-bub--ai .aiw-ai-line { font: 500 10px/1.3 var(--font-sans); white-space: nowrap; }
.aiw-bub--ai .aiw-ai-line + .aiw-ai-line { margin-top: 2px; }
.aiw-bub--ai b { color: #2b3038; font-weight: 700; }
.aiw-dots { position: absolute; display: flex; gap: 4px; opacity: 0; }
.aiw-dots i { width: 5px; height: 5px; border-radius: 50%; background: #c4cad4; }

/* sitemap board */
.aiw-node { position: absolute; display: grid; place-items: center; height: 24px; padding: 0 10px; border-radius: 8px; background: #fff; border: 1.5px solid #dfe3ec;
  font: 500 9.5px/1 var(--font-sans); color: #5c6270; white-space: nowrap; box-shadow: 0 4px 8px -6px rgba(20,30,60,.16); }

/* generated pricing page */
.aiw-url { position: absolute; left: 60px; top: 10px; width: 170px; height: 16px; border-radius: 8px; background: #f2f4f8; display: grid; place-items: center; font: 500 8.5px/1 var(--font-sans); color: #9aa1ac; }
.aiw-pcard { position: absolute; width: 80px; height: 110px; border-radius: 12px; background: #fff; border: 1.5px solid #e9edf3; box-shadow: 0 6px 16px -12px rgba(20, 30, 60, .25); }
.aiw-pname { position: absolute; left: 10px; top: 12px; font: 600 9.5px/1 var(--font-sans); color: #2b3038; white-space: nowrap; }
.aiw-pprice { position: absolute; left: 10px; top: 24px; font: 700 16px/1 var(--font-sans); color: var(--aiw-accent); }
.aiw-pprice em { margin-left: 1px; font: 600 8px/1 var(--font-sans); font-style: normal; color: #9096a2; }
.aiw-pfeat { position: absolute; left: 10px; font: 500 7.5px/1 var(--font-sans); color: #6b7280; white-space: nowrap; }
.aiw-pbtn { position: absolute; left: 10px; top: 82px; width: 60px; height: 18px; display: grid; place-items: center; border-radius: 9px; background: #fff; border: 1.5px solid var(--aiw-accent-light); color: var(--aiw-accent); font: 600 8.5px/1 var(--font-sans); }
.aiw-psel { position: absolute; left: 10px; top: 82px; width: 60px; height: 18px; display: flex; align-items: center; justify-content: center; border-radius: 9px; background: var(--aiw-accent); color: #fff; font: 600 8.5px/1 var(--font-sans); opacity: 0; box-shadow: 0 8px 14px -8px color-mix(in srgb, var(--aiw-accent) 70%, transparent); }
.aiw-psel::before { content: "✓"; margin-right: 3px; font-size: 8px; }
.aiw-prg { position: absolute; left: -3px; top: -3px; right: -3px; bottom: -3px; border: 2px solid var(--aiw-accent); border-radius: 15px; opacity: 0; pointer-events: none; }
/* product micro-interaction */
.aiw-cart { position: absolute; display: flex; align-items: center; gap: 2px; padding: 3px 8px; border-radius: 10px; background: #f2f4f8; font: 500 8px/1 var(--font-sans); color: #6b7280; }
.aiw-cnum { position: relative; display: inline-block; width: 5px; height: 8px; line-height: 8px; font-style: normal; }
.aiw-cnum b { position: absolute; left: 0; top: 0; font-weight: 700; color: #2b3038; }
.aiw-cnum b[data-a="cart1"] { opacity: 0; }
.aiw-pdimg { position: absolute; display: grid; place-items: center; border-radius: 12px; background: linear-gradient(160deg, #fff, var(--aiw-accent-soft)); box-shadow: inset 0 0 0 1px rgba(178, 188, 202, .22); color: var(--aiw-accent); }
.aiw-pdimg svg { width: 56px; height: 56px; }
.aiw-pdname { position: absolute; font: 600 12px/1 var(--font-sans); color: #23272e; white-space: nowrap; letter-spacing: -0.01em; }
.aiw-pdcost { position: absolute; font: 700 17px/1 var(--font-sans); color: var(--aiw-accent); }
.aiw-pdstock { position: absolute; display: flex; align-items: center; gap: 4px; font: 500 8px/1 var(--font-sans); color: #6b7280; }
.aiw-pdstock i { width: 5px; height: 5px; border-radius: 50%; background: #22a55a; }
.aiw-pddesc { position: absolute; font: 500 9px/1 var(--font-sans); color: #9096a2; white-space: nowrap; }
.aiw-pdbtn { position: absolute; display: grid; place-items: center; border-radius: 8px; background: var(--aiw-accent); color: #fff; font: 600 9.5px/1 var(--font-sans); box-shadow: 0 8px 14px -8px color-mix(in srgb, var(--aiw-accent) 70%, transparent); }
.aiw-pdbtn span { grid-area: 1 / 1; white-space: nowrap; }
.aiw-pdbtn span[data-a="bt2"] { opacity: 0; }
.aiw-pdtoast { position: absolute; display: flex; align-items: center; padding: 0 14px; border-radius: 10px; background: #23272e; color: #fff; font: 500 9.5px/1 var(--font-sans); box-shadow: 0 12px 24px -12px rgba(20, 30, 60, .5); }
.aiw-pdtoast b { margin-left: auto; font-weight: 600; color: #9aa1ac; }

/* login + live app */
.aiw-fld { position: absolute; font: 500 8px/1 var(--font-sans); color: #9096a2; white-space: nowrap; }
.aiw-inp { position: absolute; border-radius: 6px; background: #f2f4f8; box-shadow: inset 0 0 0 1px rgba(178, 188, 202, .30); }
.aiw-inp span { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); overflow: hidden; font: 500 8.5px/1 var(--font-sans); color: #2b3038; white-space: nowrap; }
.aiw-sibtn { position: absolute; display: grid; place-items: center; border-radius: 6px; background: var(--aiw-accent); color: #fff; font: 600 9px/1 var(--font-sans); box-shadow: 0 6px 12px -8px color-mix(in srgb, var(--aiw-accent) 70%, transparent); }
.aiw-sibtn > * { grid-area: 1 / 1; }
.aiw-sibtn .lbl { white-space: nowrap; }
.aiw-spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; opacity: 0; }
.aiw-chk { font-size: 13px; line-height: 1; opacity: 0; }
.aiw-forgot { position: absolute; font: 500 8px/1 var(--font-sans); color: var(--aiw-accent); white-space: nowrap; }
.aiw-or { position: absolute; display: flex; align-items: center; gap: 7px; height: 9px; }
.aiw-or i { flex: 1; height: 1px; background: rgba(178, 188, 202, .55); }
.aiw-or span { font: 500 7.5px/1 var(--font-sans); color: #9aa1ac; }
.aiw-soc { position: absolute; display: flex; align-items: center; justify-content: center; gap: 6px; border-radius: 6px; background: #fff; box-shadow: inset 0 0 0 1px rgba(178, 188, 202, .55), 0 1px 2px rgba(20, 30, 60, .04); font: 600 9px/1 var(--font-sans); color: #3f4652; }
.aiw-soc svg { width: 12px; height: 12px; flex: 0 0 12px; }
.aiw-act { position: absolute; left: 14px; width: 118px; height: 30px; border-radius: 8px; background: #f7f8fa; display: flex; align-items: center; gap: 7px; padding: 0 10px; box-shadow: inset 0 0 0 1px rgba(178, 188, 202, .20); }
.aiw-act i { width: 7px; height: 7px; border-radius: 50%; background: var(--aiw-accent); flex: 0 0 7px; }
.aiw-act span { font: 500 8.5px/1 var(--font-sans); color: #3f4652; white-space: nowrap; }
.aiw-act b { margin-left: auto; font: 500 7.5px/1 var(--font-mono); color: #9aa1ac; }

/* cursor tags */
.aiw-cu { position: absolute; z-index: 5; }
.aiw-cu > svg { position: absolute; left: -12px; top: -14px; width: 16px; height: 21px; filter: drop-shadow(0 3px 3px rgba(0,0,0,.22)); --cf: var(--color-blue); --cs: #fff; }
.aiw-cd > svg { --cf: #f7f9fb; --cs: #cbd3dc; }
.aiw-rp { position: absolute; left: -24px; top: -27px; width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--color-blue); opacity: 0; pointer-events: none; }
.aiw-cd .aiw-rp { border-color: #cbd3dc; }
.aiw-pl { position: absolute; left: 0; top: -42px; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px 0 4px; border-radius: 13px; color: #fff; font: 500 11px/1 var(--font-sans); white-space: nowrap;
  background: linear-gradient(180deg, rgba(255,255,255,.32), rgba(255,255,255,0) 55%), linear-gradient(180deg, #4658e6, #1b2ab0);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), inset 0 -3px 6px rgba(0,0,40,.25), 0 10px 18px -6px rgba(27,42,176,.5), 0 1px 2px rgba(0,0,0,.2); }
.aiw-cd .aiw-pl { background: linear-gradient(180deg, #fff, #eef2f5); color: #7d8792; box-shadow: inset 0 1px 0 #fff, 0 6px 14px -8px rgba(100,115,130,.3), 0 1px 2px rgba(100,115,130,.12); }
.aiw-av { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.9); background: linear-gradient(135deg, #e3e7ff, #a9b5ff); color: var(--color-blue); font: 700 9px/1 var(--font-sans); }
