/* ============================================================
   AUDIT — the signature artifact.
   "Console" aesthetic: terminal chrome, role grid, typewriter reveal,
   big savings counter. Lime accent, ink/paper palette, sharp edges.
   ============================================================ */

.audit { padding-block: var(--sp-9) var(--sp-10); }

.audit__header { margin-bottom: var(--sp-7); max-width: 760px; }
.audit__display {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: clamp(2.6rem, 7.4vw, 5.4rem);
  line-height: 0.94;
  letter-spacing: -0.035em;
  color: var(--ink);
  font-variation-settings: "wdth" 100, "opsz" 96;
  margin: var(--sp-3) 0 var(--sp-5);
}
.audit__display .highlight {
  background: var(--lime);
  padding: 0 0.1em 0.04em;
  display: inline-block;
}
.audit__lede {
  font-family: var(--font-body);
  font-size: clamp(1.05rem, 1.3vw, 1.22rem);
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 56ch;
}
.audit__pills {
  display: flex; flex-wrap: wrap; gap: var(--sp-2);
  margin-top: var(--sp-6);
}
.audit__pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 11px;
  border: 1px solid var(--ink);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: var(--paper);
  color: var(--ink);
}
.audit__pill--share { background: var(--lime); border-color: var(--lime); }
.audit__pill__dot {
  width: 7px; height: 7px;
  background: var(--lime);
  border: 1px solid var(--ink);
  border-radius: 50%;
  display: inline-block;
}

/* ============================================================
   Console — the three-state container
   ============================================================ */
.console {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--ink);
  position: relative;
  overflow: hidden;
  box-shadow: 12px 12px 0 var(--lime);
}

.console__chrome {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--sp-4);
  padding: 14px 18px;
  background: var(--shell);
  border-bottom: 1px solid var(--ink);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.console__chrome__dots {
  display: flex; gap: 7px;
}
.console__chrome__dots span {
  width: 10px; height: 10px; border-radius: 50%;
  background: color-mix(in srgb, var(--ink) 22%, transparent);
}
.console__chrome__dots span:first-child { background: var(--lime); }

.console__chrome__title {
  text-align: center;
  display: flex; align-items: center; justify-content: center; gap: var(--sp-3);
  color: var(--ink-2);
}
.console__chrome__rec {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent-deep);
}
.console__chrome__rec span {
  width: 7px; height: 7px;
  background: var(--lime);
  border-radius: 50%;
  animation: blink 1.4s steps(2) infinite;
}

.console__chrome__meta {
  display: flex; gap: var(--sp-3);
  color: var(--muted);
}

/* Panels — fade between them */
.console__panel { padding: var(--sp-7) var(--sp-6); display: none; }
.console[data-state="input"]   .console__panel--input   { display: block; }
.console[data-state="running"] .console__panel--running { display: block; }
.console[data-state="result"]  .console__panel--result  { display: block; }

/* ============================================================
   STEPS (input panel)
   ============================================================ */
.console__steps {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column;
  gap: var(--sp-7);
}
.console__step {}
.console__step__num {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin: 0 0 6px;
}
.console__step__label {
  font-family: var(--font-sans);
  font-size: clamp(1.4rem, 2.2vw, 1.9rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 var(--sp-2);
  font-variation-settings: "wdth" 95;
  display: block;
}
.console__step__hint {
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--muted);
  margin: 0 0 var(--sp-4);
  max-width: 58ch;
}

/* Role list — vertical radio-style options (reads unmistakably as a form) */
.role-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  border: 1px solid var(--rule);
}
.role {
  position: relative;
  padding: var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  text-align: left;
  background: var(--paper);
  color: var(--ink);
  border: 0;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur);
}
.role:nth-child(2n) { border-right: 0; }
.role:nth-last-child(-n+2):nth-child(odd) { border-bottom: 0; }
.role:last-child { border-bottom: 0; }
.role:hover { background: var(--accent-soft); }
.role:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.role.is-selected {
  background: var(--accent-soft);
  color: var(--ink);
}
/* The radio dot — the key "this is a form field" affordance */
.role__radio {
  flex: 0 0 auto;
  width: 18px; height: 18px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  transition: border-color var(--dur), background var(--dur);
}
.role__radio::after {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  transform: scale(0);
  transition: transform var(--dur) var(--ease);
}
.role.is-selected .role__radio { border-color: var(--accent); }
.role.is-selected .role__radio::after { transform: scale(1); }
.role__name {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: inherit;
  font-variation-settings: "wdth" 95;
}

/* Textarea */
.console__textarea {
  width: 100%;
  background: var(--shell);
  color: var(--ink);
  border: 1px solid var(--ink);
  padding: var(--sp-4);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 1.5;
  resize: none;
  border-radius: 0;
  transition: border-color var(--dur), background var(--dur);
}
.console__textarea::placeholder { color: var(--muted); }
.console__textarea:focus {
  outline: 0;
  border-color: var(--accent);
  background: var(--accent-soft);
}
.console__counter {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: right;
}

/* Size grid */
.size-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  border: 1px solid var(--rule);
}
.size {
  padding: var(--sp-4) var(--sp-3);
  background: var(--paper);
  color: var(--ink);
  border: 0;
  border-right: 1px solid var(--rule);
  cursor: pointer;
  text-align: left;
  display: flex; flex-direction: column; gap: 4px;
  transition: background var(--dur) var(--ease);
}
.size:last-child { border-right: 0; }
.size strong {
  font-family: var(--font-sans);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variation-settings: "wdth" 95;
}
.size span {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.size:hover { background: var(--accent-soft); }
.size:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.size.is-selected { background: var(--accent-soft); }
.size.is-selected strong { color: var(--ink); }
.size.is-selected span { color: var(--accent-deep); }

/* Run CTA */
.console__cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-top: var(--sp-7);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--rule);
}
.console__cta__hint {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
  text-align: right;
}
#run-audit:disabled {
  opacity: 0.35; cursor: not-allowed;
}

/* ============================================================
   RUNNING (state 2) — bars + log
   ============================================================ */
.runner { padding-block: var(--sp-6); display: flex; flex-direction: column; align-items: center; gap: var(--sp-5); }
.runner__label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin: 0;
}
.runner__bars { display: flex; gap: 6px; align-items: flex-end; height: 38px; }
.runner__bars span {
  display: block; width: 12px;
  background: var(--lime);
  animation: bar 1.1s var(--ease) infinite;
}
.runner__bars span:nth-child(1) { animation-delay: 0ms; }
.runner__bars span:nth-child(2) { animation-delay: 90ms; }
.runner__bars span:nth-child(3) { animation-delay: 180ms; }
.runner__bars span:nth-child(4) { animation-delay: 270ms; }
.runner__bars span:nth-child(5) { animation-delay: 360ms; }
.runner__bars span:nth-child(6) { animation-delay: 450ms; }
@keyframes bar {
  0%, 100% { height: 8px; opacity: 0.4; }
  50%      { height: 38px; opacity: 1; }
}
.runner__log {
  list-style: none; padding: 0; margin: 0;
  width: 100%;
  max-width: 520px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-2);
}
.runner__log li {
  opacity: 0;
  animation: log-in 200ms var(--ease) forwards;
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: var(--sp-3);
  padding: 2px 0;
}
.runner__log li::before {
  content: attr(data-ts);
  color: var(--accent-deep);
}
@keyframes log-in { to { opacity: 1; } }

/* ============================================================
   RESULT (state 3)
   ============================================================ */
.result__header { margin-bottom: var(--sp-6); }
.result__title {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: clamp(1.7rem, 3.4vw, 2.6rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin: var(--sp-3) 0 0;
  color: var(--ink);
  text-wrap: balance;
}
.result__title em {
  background: var(--lime);
  color: var(--ink);
  padding: 0 0.18em 0.06em;
  font-style: normal;
  font-variation-settings: "wdth" 75;
  display: inline-block;
  margin: 0 0.04em;
  max-width: 30ch;
}
.result__title [data-result-role] {
  color: var(--accent-deep);
}

/* Savings — the wow */
.savings {
  display: grid;
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  gap: var(--sp-6);
  align-items: center;
  padding: var(--sp-6) 0;
  margin-block: var(--sp-6);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.savings__num {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: clamp(5rem, 14vw, 11rem);
  line-height: 0.9;
  letter-spacing: -0.045em;
  color: var(--accent);
  font-variation-settings: "wdth" 100, "opsz" 96;
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
}
.savings__unit {
  font-family: var(--font-mono);
  font-size: 0.18em;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.savings__lede {
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--ink-2);
  margin: 0 0 var(--sp-3);
}
.savings__lede strong {
  background: var(--lime);
  color: var(--ink);
  padding: 0 6px 1px;
  font-weight: 500;
}
.savings__math {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
  padding-top: var(--sp-3);
  border-top: 1px dashed var(--rule);
}

/* The three prompts */
.prompts {
  list-style: none; padding: 0; margin: 0 0 var(--sp-7);
  display: grid; gap: 0;
  border: 1px solid var(--rule);
}
.prompt {
  padding: var(--sp-6);
  border-bottom: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: var(--sp-5);
  align-items: start;
}
.prompt:last-child { border-bottom: 0; }
.prompt__num {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--accent-deep);
}
.prompt__title {
  font-family: var(--font-sans);
  font-size: clamp(1.25rem, 1.8vw, 1.55rem);
  font-weight: 700;
  letter-spacing: -0.018em;
  line-height: 1.15;
  color: var(--ink);
  margin: 0 0 var(--sp-2);
  font-variation-settings: "wdth" 95;
}
.prompt__desc {
  font-family: var(--font-body);
  font-size: 0.97rem;
  line-height: 1.5;
  color: var(--ink-2);
  margin: 0 0 var(--sp-4);
  max-width: 70ch;
}
.prompt__body {
  position: relative;
  background: var(--shell);
  border-left: 3px solid var(--accent);
  padding: var(--sp-4) var(--sp-5);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0 0 var(--sp-3);
}
.prompt__body__caret {
  display: inline-block;
  width: 9px;
  height: 1.1em;
  vertical-align: -2px;
  background: var(--lime);
  margin-left: 2px;
  animation: caret 0.85s steps(2) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

.prompt__actions {
  display: flex; gap: var(--sp-3); align-items: center;
  margin-top: var(--sp-3);
}
.prompt__copy {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent;
  border: 1px solid var(--ink);
  color: var(--ink);
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background var(--dur), color var(--dur), border-color var(--dur);
}
.prompt__copy:hover { background: var(--lime); color: var(--ink); border-color: var(--lime); }
.prompt__copy.is-copied { background: var(--lime); color: var(--ink); border-color: var(--lime); }
.prompt__tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Result CTA block */
.result__cta {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: var(--sp-6);
  align-items: end;
  background: var(--lime);
  color: var(--ink);
  padding: var(--sp-6);
  margin-bottom: var(--sp-4);
}
.result__cta__copy { max-width: 50ch; }
.result__cta__lede {
  font-family: var(--font-sans);
  font-size: clamp(1.15rem, 1.7vw, 1.5rem);
  line-height: 1.25;
  color: var(--ink);
  margin: var(--sp-2) 0 0;
  letter-spacing: -0.015em;
}
.result__cta__buttons {
  display: flex; flex-direction: column; gap: var(--sp-2);
}
.result__cta .btn--lime { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.result__cta .btn--lime::before { background: var(--paper); }
.result__cta .btn--lime:hover { color: var(--ink); border-color: var(--ink); }
.result__cta .btn--ghost { background: transparent; border-color: var(--ink); color: var(--ink); }
.result__cta .btn--ghost:hover { background: var(--ink); color: var(--lime); }

.result__share {
  display: flex; gap: var(--sp-3); align-items: center;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}
.result__share__copy {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-deep);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--accent);
  padding: 0 0 2px;
  cursor: pointer;
}
.result__share__copy:hover { color: var(--ink); border-color: var(--ink); }

/* Footnote */
.audit__footnote {
  margin-top: var(--sp-6);
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--muted);
  max-width: 60ch;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 960px) {
  /* Roles collapse to a single column — cleanest "pick one" list on small screens */
  .role-list { grid-template-columns: 1fr; }
  .role { border-right: 0; border-bottom: 1px solid var(--rule); }
  .role:last-child { border-bottom: 0; }
  .size-grid { grid-template-columns: repeat(2, 1fr); }
  .size:nth-child(2n) { border-right: 0; }
  .size { border-bottom: 1px solid var(--rule); }
  .size:nth-last-child(-n+2) { border-bottom: 0; }
  .savings { grid-template-columns: 1fr; gap: var(--sp-3); }
  .result__cta { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .console__panel { padding: var(--sp-5) var(--sp-4); }
  .console__chrome__meta { display: none; }
  .console__cta { flex-direction: column; align-items: flex-start; }
  .console__cta__hint { text-align: left; }
  .prompt { grid-template-columns: 1fr; gap: var(--sp-2); }
  .prompt__num { color: var(--accent-deep); }
}
