@import url('./tokens/colors.css');
@import url('./tokens/typography.css');
@import url('./tokens/spacing.css');
@import url('./tokens/effects.css');

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-weight: var(--weight-regular);
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: var(--space-8) var(--space-4);
}

.aa {
  width: 100%;
  max-width: 660px;
}

/* ---- progress bar ---- */
.progress-bar { display: flex; gap: 6px; margin-bottom: var(--space-8); }
.pd { height: 3px; flex: 1; background: var(--color-border); border-radius: 2px; transition: background var(--duration-slow) var(--ease-standard); }
.pd.done { background: var(--color-accent); }

/* ---- shared step chrome ---- */
.tag {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-accent-text);
  background: var(--color-accent-tint);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  margin-bottom: var(--space-3);
  text-transform: uppercase;
  letter-spacing: var(--tracking-eyebrow);
}
.step { display: none; }
.step.active { display: block; }
.q-title { font-size: var(--text-h3); font-weight: var(--weight-medium); color: var(--color-text); margin-bottom: 6px; line-height: var(--leading-tight); }
.q-sub { font-size: var(--text-sm); color: var(--color-text-muted); margin-bottom: var(--space-6); line-height: var(--leading-body); }

/* ---- inputs ---- */
.input-row { display: flex; align-items: center; gap: 10px; margin-bottom: var(--space-6); }
.prefix { font-size: var(--text-lg); font-weight: var(--weight-medium); color: var(--color-text-muted); }
.big-input, .text-input {
  font-family: var(--font-sans);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
}
.big-input { font-size: var(--text-h4); font-weight: var(--weight-medium); flex: 1; padding: 10px 14px; }
.text-input { width: 100%; font-size: var(--text-base); padding: 12px 16px; margin-bottom: var(--space-4); }
.big-input:focus, .text-input:focus, .gate-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: var(--ring);
}

.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: var(--space-6); }
.opt {
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard);
}
.opt:hover { border-color: var(--color-accent); background: var(--color-bg-dim); }
.opt.sel { border-color: var(--color-accent); background: var(--color-accent-tint); color: var(--color-accent-text); font-weight: var(--weight-medium); }
.opt-sub { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: 2px; display: block; }
.opt.sel .opt-sub { color: var(--color-accent-text-deep); }

.next-btn, .gate-btn, .cta-btn, .pdf-btn {
  font-family: var(--font-sans);
  border: none;
  border-radius: var(--radius-pill);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: opacity var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-standard);
}
.next-btn:active, .gate-btn:active, .cta-btn:active { transform: scale(0.98); }
.next-btn { background: var(--color-bg-dark); color: var(--color-text-on-dark); padding: 12px 28px; }
.next-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.next-btn:hover:not(:disabled) { opacity: 0.85; }

/* ---- opening screen ---- */
.aa-logo-img { height: 22px; margin-bottom: var(--space-3); display: block; }
.aa-name { font-size: var(--text-h1); font-weight: var(--weight-medium); color: var(--color-text); line-height: var(--leading-heading); margin-bottom: 4px; }
.aa-tagline { font-size: var(--text-lg); color: var(--color-text-muted); margin-bottom: var(--space-6); font-style: italic; }
.aa-sub-text { font-size: var(--text-base); color: var(--color-text-muted); line-height: var(--leading-body); margin-bottom: var(--space-8); }

.examples { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; margin-bottom: var(--space-4); }
.ex-chip {
  font-size: var(--text-xs);
  font-family: var(--font-sans);
  color: var(--color-accent-text);
  background: var(--color-accent-tint);
  border: none;
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  cursor: pointer;
}
.ex-chip:hover { background: var(--color-accent-tint); opacity: 0.75; }

/* ---- metrics / results ---- */
.metric-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.metric-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; margin-bottom: var(--space-6); }
.mc { background: var(--color-bg-dim); border-radius: var(--radius-md); padding: var(--space-4); }
.mc-label { font-size: var(--text-xs); color: var(--color-text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: var(--tracking-wide); line-height: var(--leading-tight); }
.mc-val { font-size: var(--text-h4); font-weight: var(--weight-medium); color: var(--color-text); line-height: var(--leading-heading); }
.mc-val.red { color: var(--color-danger); }
.mc-val.gold { color: var(--color-accent); }
.mc-val.green { color: var(--color-success); }
.mc-sub { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: 5px; line-height: var(--leading-body); }

.gap-visual { background: var(--color-bg-dim); border-radius: var(--radius-lg); padding: var(--space-5) var(--space-6); margin-bottom: var(--space-6); }
.gap-visual-label { font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--color-text-muted); text-transform: uppercase; letter-spacing: var(--tracking-eyebrow); margin-bottom: var(--space-4); }
.gap-track { height: 12px; background: var(--color-border); border-radius: 6px; position: relative; margin-bottom: var(--space-3); }
.gap-fill-goal { height: 100%; border-radius: 6px; background: var(--dark-accent); opacity: 0.15; transition: width 1s ease; position: absolute; top: 0; left: 0; }
.gap-fill-ceiling { height: 100%; border-radius: 6px; background: var(--color-danger); transition: width 1s ease; position: absolute; top: 0; left: 0; }
.gap-marker { position: absolute; top: -4px; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--color-surface); transform: translateX(-50%); transition: left 1s ease; }
.gap-marker.ceiling { background: var(--color-danger); }
.gap-marker.goal { background: var(--dark-accent); }
.gap-labels { display: flex; justify-content: space-between; margin-top: var(--space-2); }
.gap-label-item { font-size: var(--text-xs); color: var(--color-text-muted); display: flex; align-items: center; gap: 5px; }
.gap-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.gap-amount-box { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; margin-top: var(--space-3); gap: var(--space-3); }
.gap-amount-label { font-size: var(--text-sm); color: var(--color-text-muted); }
.gap-amount-val { font-size: var(--text-lg); font-weight: var(--weight-medium); color: var(--color-accent); white-space: nowrap; }
.gap-amount-sub { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: 2px; }

.lev-block { border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-5); margin-bottom: var(--space-6); }
.lev-title { font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--color-text); margin-bottom: var(--space-3); text-transform: uppercase; letter-spacing: var(--tracking-wide); }
.lev-row { display: flex; align-items: center; gap: 12px; }
.lev-circle { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: var(--text-lg); font-weight: var(--weight-medium); flex-shrink: 0; }
.lev-desc { font-size: var(--text-xs); color: var(--color-text-muted); line-height: var(--leading-body); }

.insight { border-left: 3px solid var(--color-accent); border-radius: 0 var(--radius-md) var(--radius-md) 0; background: var(--color-accent-tint); padding: var(--space-4) var(--space-5); margin-bottom: var(--space-6); }
.insight p { font-size: var(--text-sm); color: var(--gold-text); margin: 0; line-height: var(--leading-body); }

/* ---- email gate ---- */
.gate-box {
  border: 1.5px solid var(--color-accent);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
}
.gate-icon { font-size: 22px; margin-bottom: var(--space-2); }
.gate-title { font-size: var(--text-h4); font-weight: var(--weight-medium); color: var(--color-text); margin-bottom: 6px; }
.gate-sub { font-size: var(--text-sm); color: var(--color-text-muted); line-height: var(--leading-body); margin-bottom: var(--space-5); }
.gate-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: var(--space-4); }
.gate-input {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  width: 100%;
}
.gate-btn { background: var(--color-accent); color: var(--color-on-accent); padding: 12px 24px; width: 100%; }
.gate-btn:hover { background: var(--color-accent-hover); }
.gate-btn.err { background: var(--color-danger); }
.gate-privacy { font-size: var(--text-xs); color: var(--color-text-faint); margin-top: var(--space-3); text-align: center; }

/* ---- transition + spinner ---- */
.transition-box { background: var(--color-bg-dark); border-radius: var(--radius-lg); padding: 1.1rem var(--space-6); margin-bottom: var(--space-6); }
.transition-box p { font-size: var(--text-base); color: var(--color-text-on-dark); margin: 0; line-height: 1.5; }
.transition-box span { color: var(--color-accent); font-weight: var(--weight-medium); }
.spinner-wrap { display: none; padding: var(--space-8) var(--space-4); text-align: center; background: var(--color-bg-dim); border-radius: var(--radius-lg); margin-bottom: var(--space-6); }
.spinner-inner { display: flex; align-items: center; justify-content: center; gap: 14px; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--color-border); border-top-color: var(--color-accent); border-radius: 50%; animation: spin 0.8s linear infinite; flex-shrink: 0; }
.spin-note { font-size: var(--text-xs); color: var(--color-text-faint); margin-top: var(--space-3); }
@keyframes spin { to { transform: rotate(360deg); } }
.spin-text { font-size: var(--text-sm); color: var(--color-text-muted); }

/* ---- blueprint ---- */
.bp-header { background: var(--color-bg-dark); border-radius: var(--radius-lg); padding: var(--space-5) var(--space-6); margin-bottom: var(--space-6); }
.bp-tag { font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--color-accent); text-transform: uppercase; letter-spacing: var(--tracking-eyebrow); margin-bottom: 6px; }
.bp-headline { font-size: var(--text-h4); font-weight: var(--weight-medium); color: var(--color-text-on-dark); line-height: var(--leading-body); margin: 0; }
.bp-summary { font-size: var(--text-base); color: var(--color-text-muted); line-height: 1.7; margin-bottom: var(--space-6); }

.four-cs { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 1px; background: var(--color-border); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: var(--space-6); }
.c-card { background: var(--color-surface); padding: var(--space-4); }
.c-letter { font-size: var(--text-h4); font-weight: var(--weight-medium); color: var(--color-accent); line-height: 1; margin-bottom: 4px; }
.c-name-lbl { font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--color-text); margin-bottom: 6px; text-transform: uppercase; letter-spacing: var(--tracking-wide); }
.c-body { font-size: 12px; color: var(--color-text-muted); line-height: 1.55; }

.asset-box { border: 1.5px solid var(--color-accent); border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5); margin-bottom: var(--space-6); }
.asset-label { font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--color-accent-text-deep); text-transform: uppercase; letter-spacing: var(--tracking-wide); margin-bottom: 6px; }
.asset-name { font-size: var(--text-base); font-weight: var(--weight-medium); color: var(--color-text); margin-bottom: var(--space-2); }
.pill { display: inline-block; background: var(--color-accent-tint); color: var(--color-accent-text); font-size: 12px; font-weight: var(--weight-medium); padding: 3px 10px; border-radius: var(--radius-pill); margin-right: 4px; margin-bottom: 4px; }

.mmm-row { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 1px; background: var(--color-border); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: var(--space-6); }
.mmm-card { background: var(--color-surface); padding: var(--space-4); }
.mmm-step { font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--color-accent); text-transform: uppercase; letter-spacing: var(--tracking-wide); margin-bottom: 4px; }
.mmm-title { font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--color-text); margin-bottom: 5px; }
.mmm-body { font-size: 12px; color: var(--color-text-muted); line-height: 1.6; }

.week-box { border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 1.1rem var(--space-5); margin-bottom: var(--space-6); }
.week-label { font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--color-text-muted); text-transform: uppercase; letter-spacing: var(--tracking-wide); margin-bottom: var(--space-3); }
.week-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: var(--space-3); }
.week-col { background: var(--color-bg-dim); border-radius: var(--radius-md); padding: 10px 12px; }
.week-col.after { background: var(--color-accent-tint); }
.week-col-label { font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--color-text-muted); margin-bottom: var(--space-2); text-transform: uppercase; letter-spacing: var(--tracking-normal); }
.week-col.after .week-col-label { color: var(--color-accent-text-deep); }
.week-item { font-size: 12px; color: var(--color-text); padding: 5px 0; border-bottom: 1px solid var(--color-border); line-height: 1.4; display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); }
.week-col.after .week-item { border-bottom-color: #EACB8A; }
.week-item:last-child { border-bottom: none; }
.week-val { font-weight: var(--weight-medium); color: var(--color-text-muted); font-size: 11px; white-space: nowrap; }
.week-col.after .week-val { color: var(--color-accent-text-deep); }
.week-val.danger { color: var(--color-danger) !important; }
.week-val.good { color: var(--color-success) !important; }
.week-note { font-size: var(--text-xs); color: var(--color-text-muted); line-height: var(--leading-body); margin: 0; }

.pricing-box { background: var(--color-bg-dim); border-radius: var(--radius-lg); padding: 1.1rem var(--space-5); margin-bottom: var(--space-6); }
.pricing-label { font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--color-text-muted); text-transform: uppercase; letter-spacing: var(--tracking-wide); margin-bottom: var(--space-3); }
.price-eq-row { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; margin-bottom: var(--space-3); }
.pe-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 10px 12px; }
.pe-card.hi { border-color: var(--color-accent); }
.pe-name { font-size: 11px; color: var(--color-text-muted); margin-bottom: 4px; }
.pe-val { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-text); line-height: 1.3; }
.pe-card.hi .pe-val { color: var(--color-accent-text-deep); }
.pe-desc { font-size: 11px; color: var(--color-text-muted); margin-top: 3px; line-height: 1.4; }
.pricing-note { font-size: var(--text-xs); color: var(--color-text-muted); line-height: var(--leading-body); margin: 0; }

/* ---- next steps + CTA ---- */
.next-steps-block { border-radius: var(--radius-lg); overflow: hidden; margin-bottom: var(--space-5); }
.next-steps-top { background: var(--color-bg-dark); padding: var(--space-5) var(--space-6); }
.ns-label { font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--color-accent); text-transform: uppercase; letter-spacing: var(--tracking-eyebrow); margin-bottom: 6px; }
.ns-title { font-size: 17px; font-weight: var(--weight-medium); color: var(--color-text-on-dark); margin: 0 0 8px; line-height: 1.4; }
.ns-body { font-size: var(--text-sm); color: var(--color-text-on-dark-muted); margin: 0; line-height: var(--leading-body); }
.next-steps-bottom { background: var(--color-accent); padding: var(--space-5) var(--space-6); text-align: center; }
.cta-label { font-size: var(--text-xs); font-weight: var(--weight-medium); color: rgba(255,255,255,0.85); text-transform: uppercase; letter-spacing: var(--tracking-wide); margin-bottom: 6px; }
.cta-heading { font-size: var(--text-base); font-weight: var(--weight-medium); color: var(--color-on-accent); margin: 0 0 var(--space-4); line-height: var(--leading-body); }
.cta-btn { background: var(--color-surface); color: var(--color-accent-text); padding: 12px 28px; display: inline-block; text-decoration: none; }
.cta-btn:hover { opacity: 0.9; }

.pdf-btn {
  display: block;
  width: 100%;
  background: none;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  padding: 10px 20px;
  margin-bottom: var(--space-3);
}
.pdf-btn:hover { border-color: var(--color-accent); color: var(--color-accent-text); }

.reset-btn { background: none; border: none; font-size: var(--text-xs); color: var(--color-text-muted); cursor: pointer; text-decoration: underline; font-family: var(--font-sans); display: block; margin: 0 auto; }

.error-note { font-size: var(--text-xs); color: var(--color-danger); margin-top: 6px; text-align: center; }

/* ---- print / PDF ---- */
.print-header { display: none; }
@media print {
  .progress-bar, #s0, #s1, #s2, #s3, #s4, .gate-box, .transition-box, .spinner-wrap,
  .pdf-btn, .reset-btn, #res-title, #res-sub, .tag, .insight { display: none !important; }
  .page { padding: 0; }
  .print-header { display: flex; align-items: center; gap: 10px; margin-bottom: var(--space-6); }
  .print-header img { height: 24px; }
  .print-header .ph-text { font-size: var(--text-sm); color: var(--color-text-muted); }
  body { background: var(--color-surface); }
}

/* ---- responsive ---- */
@media (max-width: 480px) {
  .page { padding: var(--space-6) var(--space-3); }
  .metric-grid-3, .four-cs, .mmm-row, .price-eq-row, .week-compare, .gate-fields { grid-template-columns: 1fr; }
  .opt-grid { grid-template-columns: 1fr; }
  .aa-name { font-size: var(--text-h2); }
}
