/* ============================================================
   XClarity block (Management chapter) — Claude Design direction 5a
   (3a + logo strip), built responsive.
   Lenovo Brand World palette only: Black #1E0013, Deep Purple 1 #4D144A,
   Deep Gray #4E444E, Pale Gray #E6E2E4, White. The only other colours on
   screen are inside the five XClarity logos (Lenovo artwork, not restyled).
   Font: var(--font) — "Lenovo Sans" = the bundled Gotham (Book / Bold).

   How it responds to the browser window:
   - Width: ~7vw side margins (min 48px, clears the Lenovo tab), max 1400px.
     That gives CD's 1240px at 1440 wide and 1400px at 1920 wide.
   - Type and spacing scale smoothly between CD's 1440 values (block 1240px)
     and CD's 1920 values (block 1400px), using container units.
   - Cards step on the block's own width (container queries):
       >= 1080px  five across, logos one under each card (CD's 5a)
       720–1079   three over two, bottom pair widened (no empty slot)
       < 720      single column
     The logo strip stays one row of five at every width.
   - Height: js/xclarity-fit.js scales the block down to fit between the
     Play/Ask row and the chapter band, and scrolls only as a last resort.
   ============================================================ */
/* Initially hide XClarity block */
#xclarityBlock {
  display: none;
}

#ai-xclarity-grid {
  position: fixed; z-index: 60; display: none; overflow: hidden;
  width: min(1400px, calc(100vw - 2 * max(48px, 6.9445vw)));  /* 1240px at 1440 wide */
  container-type: inline-size; container-name: xc;
  transform-origin: 50% 0;
}

#ai-xclarity-grid .xc-block {
  display: flex; flex-direction: column;
  gap: clamp(18px, calc(24px + (100cqw - 1240px) * 12 / 160), 36px);
  font-family: var(--font); color: #1E0013; text-align: left;
}

/* ---- Lead header ---- */
#ai-xclarity-grid .xc-lead {
  margin: 0;
  padding: 0 0 clamp(16px, calc(20px + (100cqw - 1240px) * 6 / 160), 26px);
  border-bottom: 3px solid #4D144A;
}
#ai-xclarity-grid .xc-lead h3 {
  margin: 0 0 clamp(10px, calc(12px + (100cqw - 1240px) * 2 / 160), 14px);
  font-family: var(--font); font-weight: 700; color: #1E0013;
  font-size: clamp(24px, calc(30px + (100cqw - 1240px) * 4 / 160), 34px);
  line-height: 0.95; letter-spacing: -0.02em;
}
#ai-xclarity-grid .xc-lead p {
  margin: 0; max-width: 54em;
  font-family: var(--font); font-weight: 400; color: #4E444E;
  font-size: clamp(15px, calc(17px + (100cqw - 1240px) / 160), 18px);
  line-height: 1.45;
}

/* ---- Five cards ---- */
#ai-xclarity-grid .xc-cards {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(12px, calc(16px + (100cqw - 1240px) * 4 / 160), 20px);
}
#ai-xclarity-grid .xc-card {
  margin: 0; list-style: none; font-size: inherit; line-height: normal;
  background: #fff; border: 1px solid #E6E2E4; border-radius: 0; box-shadow: none;
  padding: clamp(16px, calc(20px + (100cqw - 1240px) * 8 / 160), 28px)
           clamp(16px, calc(20px + (100cqw - 1240px) * 8 / 160), 28px)
           clamp(18px, calc(22px + (100cqw - 1240px) * 8 / 160), 30px);
  display: flex; flex-direction: column;
  gap: clamp(10px, calc(12px + (100cqw - 1240px) * 2 / 160), 14px);
}
#ai-xclarity-grid .xc-card h4 {
  margin: 0; display: flex; flex-direction: column;
  font-family: var(--font);
  font-size: clamp(15px, calc(16px + (100cqw - 1240px) / 160), 17px);
  line-height: 1.25; letter-spacing: -0.01em;
}
#ai-xclarity-grid .xc-card h4 .xc-family  { font-weight: 400; color: #4E444E; }  /* "XClarity" */
#ai-xclarity-grid .xc-card h4 .xc-product { font-weight: 700; color: #4D144A; }  /* "Administrator" … */
#ai-xclarity-grid .xc-card p {
  margin: 0; font-family: var(--font); font-weight: 400; color: #4E444E;
  font-size: clamp(14px, calc(14px + (100cqw - 1240px) / 160), 15px);
  line-height: 1.5;
}

/* ---- Logo strip (5a): the m1–m5 lockups, untouched, one under each card ---- */
#ai-xclarity-grid .xc-logos {
  list-style: none; margin: 0;
  padding: clamp(18px, calc(24px + (100cqw - 1240px) * 4 / 160), 28px) 0 0;
  border-top: 1px solid #E6E2E4;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(12px, calc(16px + (100cqw - 1240px) * 4 / 160), 20px);
}
#ai-xclarity-grid .xc-logos li {
  margin: 0; list-style: none; font-size: inherit; line-height: normal;
  display: flex; align-items: center; justify-content: center;
  height: clamp(32px, calc(40px + (100cqw - 1240px) * 4 / 160), 44px);
}
#ai-xclarity-grid .xc-logos img {
  display: block; width: auto; max-width: 100%; object-fit: contain;
  height: clamp(28px, calc(36px + (100cqw - 1240px) * 4 / 160), 40px);
}

/* XClarity Provisioning Manager (m5): its lockup carries a third text line, so at the
   shared height its XClarity wordmark drew ~40% smaller than the other four (the coloured X
   measures 134 against 177-199, mean 188, at equal height). Scale it 1.4x so the wordmark
   matches, and drop it by 0.2 of the shared height so its XClarity line sits level with the
   others (transform: no layout shift). Nick 2026-11-16. */
#ai-xclarity-grid .xc-logos img[src*="m5.svg"] {
  height: calc(1.4 * clamp(28px, calc(36px + (100cqw - 1240px) * 4 / 160), 40px));
  transform: translateY(14.3%);
}
/* ...which takes its "Manager" line ~0.4 x the shared height below the strip, and
   #ai-xclarity-grid clips overflow: give the strip that much room underneath. */
#ai-xclarity-grid .xc-logos {
  padding-bottom: calc(0.4 * clamp(28px, calc(36px + (100cqw - 1240px) * 4 / 160), 40px));
}

/* 1920-class width: CD's body line-height step. */
@container xc (min-width: 1360px) {
  #ai-xclarity-grid .xc-card p { line-height: 1.55; }
}

/* Narrower than the 1920-class frame: let the lead copy wrap naturally
   instead of forcing the editorial break (avoids a short second line). */
@container xc (max-width: 900px) {
  #ai-xclarity-grid .xc-lead p br { display: none; }
}

/* Medium: three over two. Six tracks — top three span 2, bottom pair
   spans 3 — so the row is always full (no empty slot). */
@container xc (max-width: 1079px) {
  #ai-xclarity-grid .xc-cards { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  #ai-xclarity-grid .xc-card { grid-column: span 2; }
  #ai-xclarity-grid .xc-card:nth-child(n+4) { grid-column: span 3; }
}

/* Narrow: one column of cards. */
@container xc (max-width: 719px) {
  #ai-xclarity-grid .xc-cards { grid-template-columns: minmax(0, 1fr); }
  #ai-xclarity-grid .xc-card,
  #ai-xclarity-grid .xc-card:nth-child(n+4) { grid-column: auto; }
}

/* Last resort on very short windows (set by js/xclarity-fit.js). */
#ai-xclarity-grid.xc-scroll { overflow-y: auto; overscroll-behavior: contain; }
