/* ============================================================================
   AI READINESS DIAGNOSTIC, PRODUCT COMPONENTS
   The real, shippable component layer. Lift these directly into the build.
   Depends on tokens.css. Components are context-aware: drop them on a light
   surface (question screens) or a .on-dark surface (hero / results).
   ========================================================================== */

/* ===========================================================================
   BUTTONS
   ========================================================================= */
.btn {
  --_bg: var(--brand-red);
  --_fg: #fff;
  font-family: var(--font-sans);
  font-size: var(--fs-body); font-weight: var(--w-bold);
  letter-spacing: var(--ls-heading);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 56px; padding: 0 var(--space-8);
  border: 0; border-radius: var(--radius-md);
  background: var(--_bg); color: var(--_fg);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform var(--dur-fast) var(--ease-spring),
              background var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              opacity var(--dur-fast);
}
.btn:hover    { background: var(--red-550); transform: translateY(-2px); box-shadow: var(--shadow-red); }
.btn:active   { background: var(--red-600); transform: translateY(0); }
.btn:focus-visible { outline: 3px solid var(--red-tint-24); outline-offset: 3px; }

/* size + width variants */
.btn--lg   { min-height: 64px; font-size: var(--fs-lead); padding: 0 var(--space-10); }
.btn--block{ display: flex; width: 100%; }

/* secondary, outline. Adapts to its surface. */
.btn--secondary {
  background: transparent; color: var(--text-strong);
  box-shadow: inset 0 0 0 1.5px var(--paper-300);
}
.btn--secondary:hover { background: transparent; box-shadow: inset 0 0 0 1.5px var(--text-strong); transform: translateY(-2px); }
.on-dark .btn--secondary { color: #fff; box-shadow: inset 0 0 0 1.5px var(--ink-500); }
.on-dark .btn--secondary:hover { box-shadow: inset 0 0 0 1.5px #fff; }

/* ghost / text */
.btn--ghost { background: transparent; color: var(--brand-red); min-height: 48px; padding: 0 var(--space-4); }
.btn--ghost:hover { background: var(--red-tint-12); transform: none; box-shadow: none; }

/* disabled (the "Next" button before an answer is chosen lives as hidden,
   but a disabled visual is documented for other gated actions) */
.btn:disabled, .btn[aria-disabled="true"] {
  background: var(--paper-200); color: var(--paper-400);
  cursor: not-allowed; box-shadow: none; transform: none; pointer-events: none;
}
.on-dark .btn:disabled { background: var(--ink-600); color: var(--ink-400); }

.btn__arrow { transition: transform var(--dur-fast) var(--ease-out); }
.btn:hover .btn__arrow { transform: translateX(4px); }

/* ===========================================================================
   FORM FIELDS  (landing page, sit on the dark hero)
   ========================================================================= */
.field { display: flex; flex-direction: column; gap: var(--space-2); }
.field__label {
  font-size: var(--fs-eyebrow); font-weight: var(--w-bold);
  letter-spacing: var(--ls-eyebrow); text-transform: uppercase; color: var(--ink-200);
}
.field__input {
  font-family: var(--font-sans); font-size: var(--fs-body); color: #fff;
  height: 56px; padding: 0 var(--space-5);
  background: var(--ink-800); border: 1.5px solid var(--ink-500);
  border-radius: var(--radius-md); width: 100%; box-sizing: border-box;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast), box-shadow var(--dur-fast);
}
.field__input::placeholder { color: var(--ink-300); }
.field__input:hover { border-color: var(--ink-400); }
.field__input:focus {
  outline: none; border-color: var(--brand-red);
  background: var(--ink-700); box-shadow: 0 0 0 4px var(--red-tint-24);
}
.field__input.is-filled { border-color: var(--ink-400); }
/* error */
.field.is-error .field__input { border-color: var(--brand-red); }
.field__error { font-size: var(--fs-sm); color: var(--red-300); display: none; }
.field.is-error .field__error { display: block; }

/* light-surface variant of fields (if ever used on paper) */
.on-light .field__label { color: var(--text-muted); }
.on-light .field__input { background: #fff; border-color: var(--paper-300); color: var(--text-strong); }
.on-light .field__input::placeholder { color: var(--text-soft); }
.on-light .field__input:focus { background: #fff; }

/* ===========================================================================
   OPTION CARDS  (question screens, sit on light paper)
   Four per question. Large tap targets (min 64px). Selected = red.
   The "I don't know" option = same weight + size, visually differentiated.
   ========================================================================= */
.options { display: flex; flex-direction: column; gap: var(--space-3); }

.option {
  --_accent: var(--brand-red);
  display: flex; align-items: flex-start; gap: var(--space-4);
  width: 100%; text-align: left; cursor: pointer;
  min-height: 64px; padding: var(--space-5) var(--space-5);
  background: var(--paper-0); color: var(--text-strong);
  border: 1.5px solid var(--paper-200); border-radius: var(--radius-lg);
  font-family: var(--font-sans); font-size: var(--fs-body); line-height: var(--lh-body);
  transition: border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              transform var(--dur-instant) var(--ease-out);
}
.option:hover { border-color: var(--paper-400); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.option:focus-visible { outline: 3px solid var(--red-tint-24); outline-offset: 2px; }

/* the letter / marker */
.option__marker {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; margin-top: 1px;
  border: 1.5px solid var(--paper-300); color: var(--text-muted);
  font-size: var(--fs-sm); font-weight: var(--w-bold);
  transition: all var(--dur-fast) var(--ease-spring);
}
.option__body { flex: 1; }
.option__text { display: block; }

/* selected */
.option.is-selected {
  border-color: var(--brand-red); background: var(--red-tint-12);
  box-shadow: 0 0 0 1px var(--brand-red);
}
.option.is-selected .option__marker {
  background: var(--brand-red); border-color: var(--brand-red); color: #fff;
  transform: scale(1.06);
}
.option.is-selected .option__text { font-weight: var(--w-semibold); }

/* "I don't know", the considered choice. Same footprint, differentiated:
   cooler surface, dashed marker, sits a touch apart. NOT lesser. */
.option--unsure { background: var(--paper-50); border-style: dashed; border-color: var(--paper-300); }
.option--unsure .option__marker { border-style: dashed; border-radius: var(--radius-sm); }
.option--unsure.is-selected {
  background: var(--ink-700); border-style: solid; border-color: var(--ink-700); color: #fff;
  box-shadow: 0 0 0 1px var(--ink-700);
}
.option--unsure.is-selected .option__marker { background: #fff; border-color: #fff; color: var(--ink-900); }
.option--unsure .option__hint {
  display: block; font-size: var(--fs-sm); color: var(--text-muted); margin-top: 2px;
}
.option--unsure.is-selected .option__hint { color: var(--ink-200); }

/* ===========================================================================
   PROGRESS INDICATOR  (top of question screens)
   Group eyebrow (in that group's colour) + "N of 15" + 15-tick rail.
   Robust to non-sequential group order.
   ========================================================================= */
.progress { display: flex; flex-direction: column; gap: var(--space-3); }
.progress__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); }
.progress__group {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-size: var(--fs-eyebrow); font-weight: var(--w-bold);
  letter-spacing: var(--ls-eyebrow); text-transform: uppercase;
  color: var(--_group, var(--brand-red));
}
.progress__group::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.progress__count { font-size: var(--fs-sm); font-weight: var(--w-semibold); color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.progress__count b { color: var(--text-strong); }
.progress__rail { display: flex; gap: 4px; }
.progress__tick { flex: 1; height: 4px; border-radius: 2px; background: var(--paper-200); transition: background var(--dur-base) var(--ease-out); }
.progress__tick.is-done { background: var(--text-strong); }
.progress__tick.is-current { background: var(--_group, var(--brand-red)); }

/* ===========================================================================
   TRAFFIC LIGHT INDICATOR  (results, RAG)
   ========================================================================= */
.rag {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-size: var(--fs-eyebrow); font-weight: var(--w-bold);
  letter-spacing: var(--ls-eyebrow); text-transform: uppercase;
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-2);
  border-radius: var(--radius-pill);
}
.rag__dot { width: 14px; height: 14px; border-radius: 50%; position: relative; }
.rag__dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1.5px solid currentColor; opacity: 0.35; }
.rag--low  { color: var(--rag-low);  background: var(--rag-low-soft); }
.rag--low  .rag__dot { background: var(--rag-low); }
.rag--mid  { color: var(--rag-mid);  background: var(--rag-mid-soft); }
.rag--mid  .rag__dot { background: var(--rag-mid); }
.rag--high { color: var(--rag-high); background: var(--rag-high-soft); }
.rag--high .rag__dot { background: var(--rag-high); }

/* ===========================================================================
   GROUP SCORE CARD  (results), bordered card, left accent line (case-study),
   traffic light, name, score, expandable narrative.
   ========================================================================= */
.group-card {
  --_accent: var(--brand-red);
  background: var(--ink-800); border: 1px solid var(--ink-600);
  border-left: 3px solid var(--_accent);
  border-radius: var(--radius-md); overflow: hidden;
}
.group-card__head {
  display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-6); cursor: pointer; width: 100%; text-align: left;
  background: transparent; border: 0; color: inherit; font-family: var(--font-sans);
}
.group-card__index {
  font-size: var(--fs-caption); font-weight: var(--w-bold); letter-spacing: var(--ls-eyebrow);
  color: var(--ink-300); font-variant-numeric: tabular-nums;
}
.group-card__name { flex: 1; font-size: var(--fs-lead); font-weight: var(--w-bold); color: #fff; letter-spacing: var(--ls-heading); }
.group-card__score { font-size: var(--fs-lead); font-weight: var(--w-extrabold); color: #fff; font-variant-numeric: tabular-nums; }
.group-card__score span { color: var(--ink-300); font-weight: var(--w-medium); font-size: var(--fs-sm); }
.group-card__chevron { color: var(--ink-300); transition: transform var(--dur-base) var(--ease-out); flex: none; }
.group-card.is-open .group-card__chevron { transform: rotate(180deg); }
.group-card__body {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows var(--dur-base) var(--ease-in-out);
}
.group-card.is-open .group-card__body { grid-template-rows: 1fr; }
.group-card__body > div { overflow: hidden; }
.group-card__narrative {
  padding: 0 var(--space-6) var(--space-6) calc(var(--space-6) + 0px);
  color: var(--ink-100); line-height: var(--lh-relaxed); font-size: var(--fs-body);
}
.group-card__narrative p { margin: 0 0 var(--space-3); max-width: 60ch; }

/* ===========================================================================
   READINESS LEVEL BADGE  (results hero)
   ========================================================================= */
.level {
  display: inline-flex; align-items: center; gap: var(--space-3);
  font-size: var(--fs-eyebrow); font-weight: var(--w-bold);
  letter-spacing: var(--ls-eyebrow); text-transform: uppercase;
  color: var(--brand-red); padding: var(--space-2) 0;
}
.level::before { content: ""; width: 32px; height: 2px; background: var(--brand-red); }

/* ===========================================================================
   CHIP / STEP NUMBER  (case-study numbered sequence motif)
   ========================================================================= */
.stepnum {
  display: inline-grid; place-items: center; width: 36px; height: 36px;
  border: 1.5px solid var(--brand-red); border-radius: 50%;
  color: var(--brand-red); font-weight: var(--w-extrabold); font-size: var(--fs-body);
}
