/* ==========================================================
   05 · AI account manager: the one dark panel on the page.
   The hero ribbon returns here, running behind the cards.
   ========================================================== */
.ai { padding: 120px 0 40px; }

/* Reference language (last brief): a pale grey shell, a faint grid, and a
   saturated wash rising from the bottom, here in the logo blues. The copy
   sits on its own white card; the stage floats over the wash. */
.ai-box {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
  gap: 40px;
  align-items: center;
  padding: 16px 48px 16px 16px;
  border-radius: 32px;
  background:
    radial-gradient(70% 55% at 70% 115%, rgba(28,77,245,.55), transparent 70%),
    radial-gradient(60% 50% at 100% 100%, rgba(75,135,255,.45), transparent 70%),
    linear-gradient(180deg, #F3F4F7 0%, #EDF0F8 45%, #C9D9FF 82%, #8FB0FF 100%);
  box-shadow: 0 0 0 1px rgba(16,24,48,.06) inset, 0 30px 70px -40px rgba(20,50,140,.35);
  color: var(--ink-950);
}
.ai-ribbon { z-index: -1; opacity: .55; }
.ai-ribbon g.r-body { filter: drop-shadow(0 14px 22px rgba(20,50,140,.25)); }

/* ---------- Copy (white inner card) ---------- */
.ai-copy {
  display: grid; gap: 22px; justify-items: start; align-self: stretch; align-content: center;
  padding: 56px 48px;
  border-radius: 22px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 0 0 1px rgba(16,24,48,.06), 0 1px 2px rgba(16,24,48,.04), 0 12px 32px -12px rgba(20,50,140,.18);
}
.ai .h2 { text-wrap: balance; }
.ai .lead { max-width: 44ch; }

.ai-points { list-style: none; margin: 4px 0 6px; padding: 0; display: grid; gap: 16px; }
.ai-points li { display: flex; gap: 14px; align-items: flex-start; }
.ap-ic {
  width: 36px; height: 36px; flex: none; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(180deg, #fff, var(--cobalt-50));
  box-shadow: 0 0 0 1px var(--cobalt-100), 0 2px 4px rgba(47,107,255,.12);
  color: var(--cobalt-600);
}
.ai-points b { display: block; font-weight: 600; font-size: 15.5px; color: var(--ink-950); }
.ai-points span { font-size: 14.5px; color: var(--ink-500); }

/* ---------- Stage (560 × 600 canvas) ---------- */
.ai-stage { position: relative; padding-block: 24px; box-sizing: content-box; }
.ai-canvas { width: 600px; height: 720px; position: relative; transform-origin: 0 0; }

.ai-card, .ai-pop {
  position: absolute;
  font-size: 12.5px; color: var(--ink-900);
  /* gradient hairline in the ribbon colours */
  background: var(--white);
  box-shadow: 0 0 0 1px rgba(16,24,48,.07);
}
.ai-card { border-radius: 18px; padding: 18px; box-shadow: 0 0 0 1px rgba(16,24,48,.07), 0 2px 4px rgba(16,24,48,.05), 0 30px 60px -24px rgba(20,40,120,.45); }
.ai-pop { z-index: 3; border-radius: 14px; box-shadow: 0 0 0 1px rgba(16,24,48,.07), 0 2px 4px rgba(16,24,48,.05), 0 20px 40px -16px rgba(20,40,120,.45); }
.ai-card small, .ai-pop small { display: block; color: var(--ink-500); font-size: 11px; }
.ai-card b, .ai-pop b { font-weight: 600; }

/* Monday updates: the card stack sits where the weekly digest was.
   Canvas placement only; the component's own CSS follows below. */
.ai-swap { position: absolute; left: -24px; top: -6px; z-index: 1; transform: scale(1.58); transform-origin: 0 0; }  /* whole stack scaled as one, so its own proportions hold */
.swap-note { right: 0; top: 404px; width: 232px; padding: 11px 12px; display: flex; align-items: center; gap: 10px; }
.swap-note b { font-size: 13px; }
.sn-ic { width: 32px; height: 32px; border-radius: 9px; flex: none; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--cobalt-400), var(--cobalt-600)); box-shadow: 0 6px 14px -4px rgba(47,107,255,.6); }

/* ══ Card swap ════════════════════════════════════════════
   js/card-swap.js (from Bencho, MIT). A stack in depth; each card's
   slot arrives as --t. Cards are the slab, a title row and a photo
   with a concentric corner. No shadows: depth is the stack and a
   hairline edge.

   Token mapping (Bencho -> this project), set on the component's own
   root so nothing leaks out:
     --fill-slab  the card frame and label pill: --white, since the
                  stack now sits on the light AI panel (Bencho's light
                  theme does the same)
     --fill-on    text on that slab: --ink-950
     --t          not a token: each card's slot transform, written
                  per card by the script                              */
.csw {
  --fill-slab: var(--white);
  --fill-on: var(--ink-950);
  position: relative;
  user-select: none;
  -webkit-user-select: none;}

.csw-stage {
  position: absolute;
  left: 30px;
  bottom: 24px;
  /* flat, so paint order is the z-index: a card sent back goes behind
     at once. The origin is the block's middle, where it was on .csw */
  perspective: 1000px;
  perspective-origin: 150px 95px;}

/* a card is a photo in a thin slab frame, its corner concentric
   with the photo's, and a solid label pill in the corner */
.csw-card {
  position: absolute;
  inset: 0;
  padding: 3px;
  border-radius: 20px;
  background: var(--fill-slab, #fff);
  color: var(--fill-on, #17181a);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--fill-on, #17181a) 12%, transparent);
  transform: var(--t);
  transition: transform 600ms cubic-bezier(0.22, 1, 0.36, 1);
  backface-visibility: hidden;}

.csw-card[data-front] { cursor: grab; touch-action: none; }

.csw-card[data-front]:active { cursor: grabbing; }

.csw-photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 17px;
  pointer-events: none;}

.csw-tag {
  position: absolute;
  left: 14px;
  bottom: 14px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--fill-slab, #fff);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  pointer-events: none;
  /* port: a client mark and the job in hand ride in the pill */
  display: flex; align-items: center; gap: 7px; padding-left: 5px;
  box-shadow: 0 1px 2px rgba(16,24,48,.12);}
.csw-tag em { font-style: normal; font-weight: 400; color: color-mix(in srgb, var(--fill-on) 55%, transparent); }
.csw-tag em::before { content: "·"; margin-right: 6px; }
.ct-lg { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--c); box-shadow: inset 0 1px 0 rgba(255,255,255,.3); }
.ct-lg svg { width: 11px; height: 11px; fill: #fff; }

/* Draft reply */
.draft { left: 216px; top: 506px; width: 384px; padding: 0; overflow: hidden; z-index: 2; }
.dr-q { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--ink-50); border-bottom: 1px solid var(--ink-100); }
.dr-q .av { --s: 26px; font-size: 9.5px; box-shadow: none; }
.dr-q p { margin: 0; color: var(--ink-800); }
.dr-q p b { margin-right: 4px; }
.dr-a { padding: 14px 16px 16px; }
.dr-label { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 8px; padding: 3px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; color: var(--cobalt-600); background: var(--cobalt-50); }
.dr-text { margin: 0; min-height: 56px; font-size: 13px; line-height: 1.5; color: var(--ink-900); }
.dr-text::after { /* caret while typing */
  content: ""; display: inline-block; width: 2px; height: 1.05em; margin-left: 1px; vertical-align: -2px;
  background: var(--cobalt-500); animation: caret 1s steps(1) infinite;
}
.dr-text.is-done::after { display: none; }
@keyframes caret { 50% { opacity: 0; } }
.dr-src { display: flex; gap: 6px; margin-top: 10px; }
.dr-src span { padding: 2px 8px; border-radius: 6px; border: 1px dashed var(--ink-200); font-size: 11px; color: var(--ink-600); }
.dr-src span::before { content: "↗ "; color: var(--ink-400); }
.dr-act { display: flex; gap: 6px; margin-top: 14px; }
.dr-act .mini-btn { height: 28px; font-size: 12px; }

/* Risk flag */
.risk { left: 0; top: 600px; width: 186px; z-index: 3; padding: 11px 13px; display: flex; align-items: center; gap: 10px; }
.rk-ic { width: 28px; height: 28px; border-radius: 8px; flex: none; display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--rose-500); box-shadow: 0 6px 14px -4px rgba(240,80,110,.6); }

/* ---------- Responsive ---------- */
@media (max-width: 1023px) {
  .ai-box { grid-template-columns: minmax(0, 1fr); padding: 16px 16px 48px; gap: 40px; }
  .ai-stage { max-width: 600px; width: 100%; justify-self: center; }
}
@media (max-width: 767px) {
  .ai { padding: 72px 0 24px; }
  .ai-box { padding: 10px 10px 28px; border-radius: 24px; gap: 28px; }
  .ai-copy { padding: 32px 22px; border-radius: 18px; }
  .ai-points b { font-size: 15px; }
  .ai-points span { font-size: 14px; }
}
