/* ============================================================
   AI Readiness Assessment · tool-specific styles
   Loaded after styles.css — inherits tokens, buttons, .spot
   ============================================================ */

:root {
  /* Chart colors — validated against surface #11131c (dark).
     Emphasis palette: one hue + de-emphasis gray.
     accent  #0ea5c4  L 0.55  · in band, contrast >= 3:1
     muted   #5b6b85  reads gray by design (de-emphasis)
     Adjacent separation: CVD dE 14.2 / normal dE 16.8 — both clear.
     Identity never rests on color: every bar is text-labelled and
     carries a direct value. */
  --viz-accent: #0ea5c4;
  --viz-accent-glow: rgba(14, 165, 196, 0.45);
  --viz-muted: #5b6b85;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Tool nav ---------- */
.nav--tool { position: fixed; }
.nav__toolname {
  margin-right: auto; font-family: "Space Grotesk", sans-serif; font-weight: 600;
  font-size: 14.5px; letter-spacing: -0.01em; color: var(--muted);
}
.nav--tool .nav__actions { display: flex; }

/* ---------- Stages ---------- */
.tool { padding: 128px 0 90px; min-height: 100svh; }
.stage { display: none; }
.stage--active { display: block; animation: stageIn 0.6s var(--ease) both; }
@keyframes stageIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.tool__inner { max-width: 820px; }

/* ---------- Intro ---------- */
.tool__title { font-size: clamp(2rem, 5.2vw, 3.4rem); margin: 6px 0 0; }
.tool__lead { margin-top: 24px; font-size: clamp(1.02rem, 1.4vw, 1.18rem); color: var(--muted); max-width: 62ch; text-wrap: pretty; }
.tool__meta { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.tool__meta li {
  font-size: 13px; color: var(--muted); padding: 7px 14px;
  border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,0.02);
}
.tool__meta strong { color: var(--text); font-weight: 600; }

.dims-preview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 30px 0 34px; }
.dim-chip {
  display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--muted);
  padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px;
  background: linear-gradient(165deg, var(--panel), var(--bg-soft));
}
.dim-chip span {
  font-family: "Space Grotesk"; font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--cyan); opacity: 0.75;
}
.tool__fineprint { margin-top: 22px; font-size: 13px; color: var(--muted-2); max-width: 60ch; text-wrap: pretty; }

/* ---------- Quiz ---------- */
.quiz__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.quiz__count { font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-2); }
.quiz__count b { color: var(--text); font-weight: 600; }
.quiz__dim { font-size: 12.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--cyan); }
.quiz__track { height: 2px; background: rgba(255,255,255,0.07); border-radius: 2px; margin: 14px 0 34px; overflow: hidden; }
.quiz__track i {
  display: block; height: 100%; width: 100%; background: var(--grad);
  transform: scaleX(0); transform-origin: 0 50%; transition: transform 0.5s var(--ease);
}
.quiz__question { font-size: clamp(1.4rem, 3vw, 2.1rem); margin-bottom: 28px; max-width: 24ch; }

.options { display: grid; gap: 10px; }
.option {
  position: relative; display: flex; align-items: flex-start; gap: 14px; width: 100%;
  text-align: left; font: inherit; font-size: 1rem; color: var(--muted); cursor: pointer;
  padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px;
  background: linear-gradient(165deg, var(--panel), var(--bg-soft));
  transition: transform 0.3s var(--ease), border-color 0.3s, color 0.3s, background 0.3s;
}
.option:hover { transform: translateX(3px); border-color: var(--line-strong); color: var(--text); }
.option:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.option__key {
  flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px;
  font-family: "Space Grotesk"; font-size: 12px; font-weight: 700; color: var(--muted-2);
  border: 1px solid var(--line-strong); background: rgba(8,9,13,0.7); transition: 0.3s var(--ease);
}
.option__text { padding-top: 2px; text-wrap: pretty; }
.option--on { border-color: color-mix(in srgb, var(--cyan) 55%, var(--line-strong)); color: var(--text); background: radial-gradient(120% 140% at 0% 0%, rgba(34,211,238,0.12), var(--panel) 60%); }
.option--on .option__key { color: #061018; background: var(--cyan); border-color: var(--cyan); }

.quiz__nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 26px; flex-wrap: wrap; }
.quiz__nav .btn:disabled { opacity: 0.35; cursor: not-allowed; }
.quiz__hint { font-size: 12.5px; color: var(--muted-2); }
.quiz__hint kbd {
  font-family: ui-monospace, Consolas, monospace; font-size: 11px; padding: 2px 6px;
  border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; color: var(--muted);
}

/* ---------- Result: hero + verdict ---------- */
.score-head { display: grid; grid-template-columns: auto 1fr; gap: 34px; align-items: center; margin: 10px 0 34px; }
.score-hero { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }
.score-hero__num {
  font-family: "Space Grotesk"; font-size: clamp(4rem, 12vw, 7rem); font-weight: 700;
  line-height: 0.9; letter-spacing: -0.05em; font-variant-numeric: tabular-nums;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.score-hero__of { font-family: "Space Grotesk"; font-size: 1.4rem; font-weight: 600; color: var(--muted-2); }
.score-hero__label {
  display: block; width: 100%; margin-top: 8px; font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted-2);
}
.score-verdict h2 { font-size: clamp(1.3rem, 2.6vw, 1.9rem); margin-bottom: 10px; }
.score-verdict p { color: var(--muted); text-wrap: pretty; }

/* ---------- Phase stepper ---------- */
.phases { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 40px; }
.phases li {
  position: relative; padding: 14px 12px 15px; border-radius: 12px; text-align: center;
  font-size: 13px; font-weight: 600; color: var(--muted-2);
  border: 1px solid var(--line); background: var(--bg-soft); transition: 0.45s var(--ease);
}
.phases li span {
  display: block; font-family: "Space Grotesk"; font-size: 10.5px; letter-spacing: 0.14em;
  margin-bottom: 5px; opacity: 0.7;
}
.phases li.done { color: var(--muted); border-color: var(--line-strong); }
.phases li.on {
  color: #061018; background: var(--grad); border-color: transparent;
  box-shadow: 0 10px 30px rgba(34,211,238,0.28);
}
.phases li.on span { opacity: 0.85; }

/* ---------- Chart ---------- */
.chart {
  margin: 0 0 34px; padding: 26px 26px 20px; border: 1px solid var(--line);
  border-radius: var(--r); background: var(--panel);
}
.chart__title { font-family: "Space Grotesk"; font-weight: 600; font-size: 1.06rem; margin-bottom: 22px; }
.chart__sub { display: block; font-family: "Inter"; font-size: 13px; font-weight: 400; color: var(--muted-2); margin-top: 5px; }

/* minmax(0,1fr) is load-bearing: an implicit `auto` column sizes its row under a
   max-content constraint, where the bar's own 1fr track contributes 0 and the
   track collapses to zero width. */
.bars { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.bar { display: grid; grid-template-columns: 190px minmax(0, 1fr) 42px; gap: 14px; align-items: center; }
.bar__label { font-size: 13.5px; color: var(--muted); text-align: right; }
.bar__track { min-width: 0; height: 12px; border-radius: 4px; background: rgba(255,255,255,0.05); overflow: hidden; }
.bar__track i {
  display: block; height: 100%; width: var(--w); border-radius: 4px; background: var(--viz-muted);
  transform-origin: 0 50%; animation: barGrow 0.85s var(--ease) both; animation-delay: var(--d);
}
@keyframes barGrow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.bar__val {
  font-family: "Space Grotesk"; font-size: 14px; font-weight: 700; color: var(--muted);
  font-variant-numeric: tabular-nums; text-align: right;
}
.bar--accent .bar__track i { background: var(--viz-accent); box-shadow: 0 0 14px var(--viz-accent-glow); }
.bar--accent .bar__label,
.bar--accent .bar__val { color: var(--text); }

.chart__legend { display: flex; gap: 20px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.lg { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted-2); }
.lg__sw { width: 11px; height: 11px; border-radius: 3px; }
.lg__sw--accent { background: var(--viz-accent); }
.lg__sw--muted { background: var(--viz-muted); }

.chart__table { margin-top: 14px; }
.chart__table summary { font-size: 12.5px; color: var(--muted-2); cursor: pointer; }
.chart__table summary:hover { color: var(--muted); }
.chart__table table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13.5px; }
.chart__table th, .chart__table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.chart__table thead th { font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-2); }
.chart__table tbody th { font-weight: 500; color: var(--muted); }
.chart__table td { text-align: right; font-family: "Space Grotesk"; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- Insights ---------- */
.insights { display: grid; gap: 14px; margin-bottom: 34px; }
.insight {
  position: relative; padding: 22px 24px; border-radius: var(--r);
  border: 1px solid var(--line); background: linear-gradient(165deg, var(--panel), var(--bg-soft));
}
.insight h3 { position: relative; z-index: 4; font-size: 1.08rem; margin-bottom: 9px; }
.insight p { position: relative; z-index: 4; font-size: 0.97rem; color: var(--muted); text-wrap: pretty; }
.insight--warn { border-color: color-mix(in srgb, #fb7185 32%, var(--line-strong)); }
.insight--warn h3::before { content: "▲ "; color: #fb7185; font-size: 0.8em; }
.insight--ok { border-color: color-mix(in srgb, #34d399 32%, var(--line-strong)); }
.insight--ok h3::before { content: "● "; color: #34d399; font-size: 0.8em; }

/* ---------- Written readout ---------- */
.readout {
  padding: 28px 30px; border-radius: var(--r); margin-bottom: 34px;
  border: 1px solid color-mix(in srgb, var(--cyan) 30%, var(--line-strong));
  background: radial-gradient(130% 150% at 0% 0%, rgba(34,211,238,0.09), var(--bg-soft) 62%);
}
.readout__head { margin-bottom: 18px; }
.readout__badge {
  display: inline-flex; align-items: center; gap: 9px; font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--cyan);
}
.readout__headline { font-size: clamp(1.2rem, 2.3vw, 1.6rem); margin-bottom: 14px; }
.readout__diagnosis { color: var(--muted); font-size: 1.02rem; text-wrap: pretty; }
.readout__actions { list-style: none; counter-reset: act; display: grid; gap: 14px; margin-top: 24px; }
.readout__actions li { counter-increment: act; position: relative; padding-left: 40px; }
.readout__actions li::before {
  content: counter(act, decimal-leading-zero); position: absolute; left: 0; top: 1px;
  font-family: "Space Grotesk"; font-size: 12px; font-weight: 700; color: var(--cyan);
  border: 1px solid color-mix(in srgb, var(--cyan) 35%, transparent);
  border-radius: 7px; padding: 3px 6px;
}
.readout__actions b { display: block; color: var(--text); font-size: 1rem; margin-bottom: 4px; }
.readout__actions span { color: var(--muted); font-size: 0.95rem; text-wrap: pretty; }
.readout__note { margin-top: 20px; font-size: 12px; color: var(--muted-2); }
.readout__loading { display: flex; align-items: center; gap: 8px; color: var(--muted-2); font-size: 14px; }
.readout__loading span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--cyan);
  animation: dotPulse 1.3s var(--ease) infinite;
}
.readout__loading span:nth-child(2) { animation-delay: 0.18s; }
.readout__loading span:nth-child(3) { animation-delay: 0.36s; margin-right: 6px; }
@keyframes dotPulse { 0%, 100% { opacity: 0.25; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1); } }

/* ---------- Plan CTA ---------- */
.plan-cta {
  padding: 30px 32px; border-radius: var(--r); margin-bottom: 30px;
  border: 1px solid var(--line-strong);
  background: radial-gradient(130% 160% at 100% 0%, rgba(167,139,250,0.11), var(--bg-soft) 70%);
}
.plan-cta h3 { font-size: clamp(1.2rem, 2.2vw, 1.55rem); margin-bottom: 10px; }
.plan-cta > p { color: var(--muted); max-width: 60ch; text-wrap: pretty; }
.plan-form { margin-top: 22px; }
.plan-form__row { display: flex; gap: 10px; flex-wrap: wrap; }
.plan-form input[type="email"] {
  flex: 1 1 240px; font-family: inherit; font-size: 15px; color: var(--text);
  background: rgba(255,255,255,0.03); border: 1px solid var(--line-strong);
  border-radius: 12px; padding: 13px 15px; transition: border-color 0.25s, background 0.25s, box-shadow 0.25s;
}
.plan-form input[type="email"]::placeholder { color: var(--muted-2); }
.plan-form input[type="email"]:focus {
  outline: none; border-color: var(--cyan); background: rgba(34,211,238,0.04);
  box-shadow: 0 0 0 3px rgba(34,211,238,0.12);
}
.plan-form .form-status { text-align: left; }

.result-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .score-head { grid-template-columns: 1fr; gap: 20px; }
  .dims-preview { grid-template-columns: 1fr 1fr; }
  .bar { grid-template-columns: 1fr; gap: 6px; }
  .bar__label { text-align: left; }
  .bar__val { text-align: left; margin-top: 2px; }
  .phases { grid-template-columns: repeat(5, 1fr); gap: 5px; }
  .phases li { padding: 11px 5px 12px; font-size: 10.5px; }
  .phases li span { font-size: 9.5px; }
}
@media (max-width: 620px) {
  .tool { padding-top: 108px; }
  .dims-preview { grid-template-columns: 1fr; }
  .chart { padding: 20px 18px 16px; }
  .readout, .plan-cta { padding: 22px 20px; }
  .quiz__hint { display: none; }
  .chart__legend { flex-direction: column; gap: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .stage--active { animation: none; }
  .bar__track i { animation: none; transform: none; }
  .readout__loading span { animation: none; opacity: 0.6; }
}
