/* Ask Neuro "What Ask Neuro delivers" panel visuals. Section shell, cards and panel surfaces come
   from platform-capabilities.css; variables are the shared --cap-* set. */

.platform-cap {
  --ask-navy: #13324a;
  --ask-cyan: #0ea5e9;
  --ask-amber: #b45309;
  --ask-amber-soft: rgba(180, 83, 9, 0.08);
}

/* =========================================================
   Shared conversation pieces
   ========================================================= */
.ask-chat {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ask-chat__head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.ask-chat__mark {
  position: relative;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #7dd3fc, var(--cap-cyan-deep) 70%);
}

.ask-chat__mark::after {
  content: "";
  position: absolute;
  inset: 28%;
  background: #fff;
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}

.ask-chat__q {
  align-self: flex-end;
  max-width: 85%;
  padding: 8px 13px;
  border-radius: 14px 14px 4px 14px;
  background: var(--ask-navy);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  color: #fff;
}

.ask-chat__a {
  max-width: 92%;
  padding: 11px 14px 12px;
  border-radius: 14px 14px 14px 4px;
  background: #f4f6f9;
  font-size: 14px;
  line-height: 1.5;
}

.ask-chat__a > p:first-child {
  text-wrap: pretty;
}

.ask-chat__steps {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: ask-step;
}

.ask-chat__steps li {
  display: flex;
  align-items: baseline;
  gap: 9px;
  counter-increment: ask-step;
}

.ask-chat__steps li::before {
  content: counter(ask-step);
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(3, 105, 161, 0.1);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--cap-cyan-deep);
}

.ask-chat__source {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--cap-line);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--cap-teal);
}

.ask-chat__source::before {
  content: "";
  width: 9px;
  height: 11px;
  flex-shrink: 0;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}

/* Citation number, matching a step to its document */
.ask-cite {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  flex-shrink: 0;
  padding: 0 4px;
  border-radius: 5px;
  background: var(--cap-teal-soft);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
  color: var(--cap-teal);
}

/* =========================================================
   Card 1 — Grounded answers: library search, then a cited answer
   States (data-state): idle → ask → search → found → answer (data-step 1–3)
   ========================================================= */
.ask-ground__body {
  display: grid;
  gap: 18px;
}

@container (min-width: 640px) {
  .ask-ground__body {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 28px;
    align-items: start;
  }
}

.ask-ground__docs {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ask-ground__doc {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  padding: 9px 11px;
  border: 1px solid var(--cap-line);
  border-radius: 10px;
  background: #fff;
  transition: border-color 0.4s ease, box-shadow 0.4s ease, opacity 0.4s ease;
}

.ask-ground__type {
  --ask-type: var(--cap-muted);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 42px;
  padding: 3px 0;
  border-radius: 6px;
  background: color-mix(in srgb, var(--ask-type) 10%, transparent);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.04em;
  color: var(--ask-type);
}

.ask-ground__type--pdf { --ask-type: #b91c1c; }
.ask-ground__type--doc { --ask-type: #1d4ed8; }
.ask-ground__type--video { --ask-type: #0f766e; }
.ask-ground__type--sheet { --ask-type: #15803d; }

.ask-ground__doc-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.35;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ask-ground__doc .ask-cite {
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Search sweep across each document in turn */
.ask-ground__doc::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(14, 165, 233, 0.14), transparent);
  transform: translateX(-100%);
  pointer-events: none;
}

.ask-ground[data-state="search"] .ask-ground__doc::after {
  animation: ask-ground-sweep 0.7s ease-in-out calc(var(--i) * 0.16s) both;
}

@keyframes ask-ground-sweep {
  to { transform: translateX(100%); }
}

.ask-ground:is([data-state="found"], [data-state="answer"]) .ask-ground__doc:not(.is-match) {
  opacity: 0.45;
}

.ask-ground:is([data-state="found"], [data-state="answer"]) .ask-ground__doc.is-match {
  border-color: rgba(15, 118, 110, 0.35);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.07);
}

.ask-ground:is([data-state="found"], [data-state="answer"]) .ask-ground__doc.is-match .ask-cite {
  opacity: 1;
  transform: none;
}

.ask-ground__chat {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100%;
  padding: 14px 16px 16px;
  border: 1px solid var(--cap-line);
  border-radius: 14px;
  background: #fff;
}

.ask-ground__chat .ask-chat__head {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--cap-line);
}

.ask-ground__q {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s ease, transform 0.4s var(--cap-ease);
}

.ask-ground:not([data-state="idle"]) .ask-ground__q {
  opacity: 1;
  transform: none;
}

.ask-ground__status {
  display: grid;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--cap-faint);
}

.ask-ground__status > span {
  grid-area: 1 / 1;
  display: flex;
  align-items: center;
  gap: 7px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.ask-ground__status-search::before {
  content: "";
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1.5px solid var(--ask-cyan);
  border-right-color: rgba(14, 165, 233, 0.15);
  animation: ask-ground-spin 0.9s linear infinite;
}

.ask-ground__status-found {
  color: var(--cap-teal);
}

.ask-ground__status-found::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

@keyframes ask-ground-spin {
  to { transform: rotate(360deg); }
}

.ask-ground[data-state="search"] .ask-ground__status-search,
.ask-ground:is([data-state="found"], [data-state="answer"]) .ask-ground__status-found {
  opacity: 1;
}

.ask-ground__steps {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ask-ground__step {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 12px 12px 12px 4px;
  background: #f4f6f9;
  font-size: 14px;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s ease, transform 0.4s var(--cap-ease);
}

.ask-ground__step p {
  flex: 1;
  min-width: 0;
}

.ask-ground__num {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(3, 105, 161, 0.1);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--cap-cyan-deep);
}

.ask-ground[data-state="answer"][data-step="1"] .ask-ground__step:nth-child(-n + 1),
.ask-ground[data-state="answer"][data-step="2"] .ask-ground__step:nth-child(-n + 2),
.ask-ground[data-state="answer"][data-step="3"] .ask-ground__step {
  opacity: 1;
  transform: none;
}

/* =========================================================
   Card 2 — In training
   ========================================================= */
.ask-lesson__bar {
  display: block;
  height: 5px;
  margin-top: -4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(3, 105, 161, 0.12);
}

.ask-lesson__bar i {
  display: block;
  width: 57.3%;
  height: 100%;
  border-radius: inherit;
  background: var(--cap-cyan-deep);
}

.ask-lesson .ask-chat,
.ask-support .ask-chat,
.ask-admin .ask-chat {
  flex: 1;
  justify-content: center;
}

/* =========================================================
   Card 4 — Analytics: readiness against the threshold
   ========================================================= */
.ask-admin__bars {
  display: grid;
  gap: 7px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.ask-admin__bars li {
  display: grid;
  grid-template-columns: minmax(0, 104px) minmax(0, 1fr) 24px;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  line-height: 1.3;
}

.ask-admin__name {
  overflow: hidden;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--cap-muted);
}

.ask-admin__meter {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: rgba(23, 34, 53, 0.08);
}

/* Threshold marker at 60 */
.ask-admin__meter::after {
  content: "";
  position: absolute;
  left: 60%;
  top: -3px;
  bottom: -3px;
  border-left: 1.5px dashed rgba(23, 34, 53, 0.35);
}

.ask-admin__meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--cap-teal);
  transform: scaleX(var(--v));
  transform-origin: left center;
}

.ask-admin__score {
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ask-admin__bars li.is-below .ask-admin__name {
  font-weight: 600;
  color: var(--cap-ink);
}

.ask-admin__bars li.is-below .ask-admin__meter i {
  background: #dc2626;
}

.ask-admin__bars li.is-below .ask-admin__score {
  color: #dc2626;
}

/* =========================================================
   Card 5 — Top support questions
   ========================================================= */
.ask-top__list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ask-top__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(48px, 90px) 24px 92px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--cap-line);
  border-radius: 10px;
  background: #fff;
}

.ask-top__row.is-gap {
  border-color: rgba(180, 83, 9, 0.3);
  background: var(--ask-amber-soft);
}

.ask-top__step {
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ask-top__where {
  margin-top: 1px;
  font-size: 12px;
  line-height: 1.3;
  color: var(--cap-faint);
}

.ask-top__meter {
  height: 6px;
  border-radius: 999px;
  background: rgba(23, 34, 53, 0.08);
}

.ask-top__meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--cap-blue);
  transform: scaleX(var(--v));
  transform-origin: left center;
}

.ask-top__row.is-gap .ask-top__meter i {
  background: var(--ask-amber);
}

.ask-top__count {
  font-size: 13.5px;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ask-top__row .platform-cap__chip {
  justify-self: end;
}

.ask-top__chip--gap {
  border-color: rgba(180, 83, 9, 0.3);
  background: #fff;
  color: var(--ask-amber);
}

.ask-top__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: auto;
}

@container (max-width: 420px) {
  .ask-top__row {
    grid-template-columns: minmax(0, 1fr) 24px auto;
    row-gap: 8px;
  }

  .ask-top__meter {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .ask-chat__q,
  .ask-chat__a {
    max-width: 100%;
  }

  .ask-admin__bars li {
    grid-template-columns: minmax(0, 92px) minmax(0, 1fr) 22px;
  }
}

/* Meters grow in once their panel is in view */
.platform-cap.is-enhanced :is(.ask-admin__meter i, .ask-top__meter i) {
  transform: scaleX(0);
  transition: transform 1.1s var(--cap-ease) 0.45s;
}

.platform-cap.is-enhanced .is-inview :is(.ask-admin__meter i, .ask-top__meter i) {
  transform: scaleX(var(--v));
}
