/* ───────────────────────────────────────────────────────────
   Intelligence Age Scorecard — Post-Report Feedback Form
   Direct port of docs/reviews/feedback-form-mockup.html minus
   the demo-switcher chrome. Self-hosted fonts inline.

   Locked invariants (REGRESSION-GUARD):
   - .question font-weight: 500 (NOT 300) for legibility on dark bg
   - textarea typed text #ffffff, placeholder rgba(226,226,225,0.22)
     italic — distinguishably faint vs typed
   ─────────────────────────────────────────────────────────── */

@font-face{font-family:'Work Sans';src:url('/assets/fonts/work-sans-latin.woff2') format('woff2');font-weight:300 700;font-style:normal;font-display:optional}
@font-face{font-family:'DM Sans';src:url('/assets/fonts/dm-sans-latin.woff2') format('woff2');font-weight:400 700;font-style:normal;font-display:optional}

:root {
  --space: #162535;
  --space-lighter: #1d2f43;
  --space-light: #243a52;
  --teal: #30ffeb;
  --teal-dim: rgba(48, 255, 235, 0.15);
  --purple: #5033ff;
  --titanium: #e2e2e1;
  --titanium-dim: rgba(226, 226, 225, 0.6);
  --titanium-fade: rgba(226, 226, 225, 0.35);
  --titanium-faint: rgba(226, 226, 225, 0.22);
  --error: #ff6b6b;
  --amber: #ffb454;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--space);
  color: var(--titanium);
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  background-image:
    radial-gradient(circle at 20% 0%, rgba(80, 51, 255, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 100%, rgba(48, 255, 235, 0.05) 0%, transparent 50%);
  display: flex;
  flex-direction: column;
}

/* Loading state (shown while feedback-report.js fetches lookup-context) */
.fr-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  gap: 16px;
  font-family: 'Work Sans', sans-serif;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--titanium-fade);
}
.fr-spinner {
  width: 40px;
  height: 40px;
  border: 2px solid rgba(48, 255, 235, 0.15);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: fr-spin 0.8s linear infinite;
}
@keyframes fr-spin { to { transform: rotate(360deg); } }

/* Error state (404/410/425/network) */
.fr-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  padding: 0 24px;
  text-align: center;
  font-family: 'Work Sans', sans-serif;
}
.fr-error h1 {
  font-weight: 500;
  font-size: 28px;
  color: #ffffff;
  letter-spacing: -0.4px;
  margin-bottom: 16px;
}
.fr-error p {
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  color: var(--titanium-dim);
  max-width: 480px;
  line-height: 1.6;
}

/* Progress bar */
.progress-shell {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  background: rgba(22, 37, 53, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(226, 226, 225, 0.06);
}
.progress-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.progress-label {
  font-family: 'Work Sans', sans-serif;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--titanium-fade);
  white-space: nowrap;
}
.progress-track {
  flex: 1;
  height: 2px;
  background: rgba(226, 226, 225, 0.12);
  position: relative;
  overflow: hidden;
}
.progress-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: var(--teal);
  transition: width 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.progress-counter {
  font-family: 'Work Sans', sans-serif;
  font-weight: 500;
  font-size: 12px;
  color: var(--teal);
  letter-spacing: 1px;
  white-space: nowrap;
}

/* Screen layout */
.flow {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 100px 24px 140px;
  position: relative;
}
.screen {
  width: 100%;
  max-width: 640px;
  display: none;
  animation: fadeUp 0.5s ease;
}
.screen.active { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.eyebrow {
  font-family: 'Work Sans', sans-serif;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.eyebrow::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--teal);
}

/* QUESTION HEADING — locked weight 500 (NOT 300) per REGRESSION-GUARD */
.question {
  font-family: 'Work Sans', sans-serif;
  font-weight: 500;
  font-size: 36px;
  line-height: 1.25;
  color: #ffffff;
  margin-bottom: 16px;
  letter-spacing: -0.4px;
}
.question strong {
  font-weight: 700;
  color: var(--teal);
}

.subtext {
  font-size: 16px;
  color: var(--titanium-dim);
  margin-bottom: 56px;
  max-width: 520px;
}

/* Scale buttons (Q1, Q3 = 5 buttons; Q2 = 11 buttons) */
.scale-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.scale-row.eleven { gap: 6px; }

.scale-button {
  flex: 1;
  min-width: 56px;
  height: 64px;
  background: transparent;
  border: 1px solid rgba(226, 226, 225, 0.18);
  color: var(--titanium);
  font-family: 'Work Sans', sans-serif;
  font-weight: 500;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.scale-row.eleven .scale-button {
  height: 56px;
  font-size: 16px;
  min-width: 44px;
}
.scale-button:hover {
  border-color: var(--teal);
  color: var(--teal);
  transform: translateY(-1px);
}
.scale-button.selected {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--space);
}
.scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--titanium-fade);
  margin-top: 8px;
}

/* Textarea — typed white, placeholder distinctly faint italic.
   Locked invariant per REGRESSION-GUARD. */
.textarea-wrapper { position: relative; }

textarea {
  width: 100%;
  min-height: 180px;
  background: var(--space-lighter);
  border: 1px solid rgba(226, 226, 225, 0.15);
  color: #ffffff;
  font-family: 'DM Sans', sans-serif;
  font-size: 17px;
  line-height: 1.6;
  padding: 20px 24px;
  resize: vertical;
  transition: border-color 0.18s ease;
}
textarea:focus {
  outline: none;
  border-color: var(--teal);
}
textarea::placeholder {
  color: var(--titanium-faint);
  font-style: italic;
  opacity: 1;
}

.char-counter {
  position: absolute;
  bottom: 12px;
  right: 16px;
  font-size: 12px;
  color: var(--titanium-fade);
  font-family: 'Work Sans', sans-serif;
  background: var(--space-lighter);
  padding: 2px 6px;
}
.char-counter.warning { color: var(--amber); }
.char-counter.error { color: var(--error); }

/* Consent (Q5) */
.consent-block {
  background: var(--space-lighter);
  border: 1px solid rgba(48, 255, 235, 0.2);
  padding: 32px;
  margin-bottom: 24px;
}
.consent-text {
  font-size: 15px;
  color: var(--titanium);
  line-height: 1.6;
}
.consent-text .score-highlight {
  color: var(--teal);
  font-weight: 500;
}

.consent-toggle-row {
  display: flex;
  gap: 12px;
}
.consent-button {
  flex: 1;
  height: 64px;
  background: transparent;
  border: 1px solid rgba(226, 226, 225, 0.25);
  color: var(--titanium);
  font-family: 'Work Sans', sans-serif;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.18s ease;
}
.consent-button:hover {
  border-color: var(--teal);
  color: var(--teal);
}
.consent-button.selected {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--space);
}

/* Footer nav */
.nav-shell {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 10;
  background: rgba(22, 37, 53, 0.92);
  backdrop-filter: blur(8px);
  border-top: 1px solid rgba(226, 226, 225, 0.06);
}
.nav-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.nav-back {
  background: transparent;
  border: none;
  color: var(--titanium-dim);
  font-family: 'Work Sans', sans-serif;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 8px;
  transition: color 0.15s;
}
.nav-back:hover { color: var(--teal); }
.nav-back:disabled { opacity: 0.3; cursor: not-allowed; }
.nav-back .arrow { font-size: 16px; }

.nav-skip {
  background: transparent;
  border: none;
  color: var(--titanium-fade);
  font-family: 'Work Sans', sans-serif;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  padding: 12px 8px;
  margin-left: auto;
  margin-right: 16px;
  transition: color 0.15s;
}
.nav-skip:hover { color: var(--titanium); }

.nav-next {
  background: var(--teal);
  color: var(--space);
  border: none;
  font-family: 'Work Sans', sans-serif;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 18px 40px;
  cursor: pointer;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.nav-next:hover:not(:disabled) {
  background: #6affe0;
  transform: translateY(-1px);
}
.nav-next:disabled {
  background: var(--space-light);
  color: var(--titanium-fade);
  cursor: not-allowed;
  transform: none;
}
.nav-next .arrow { font-size: 18px; }

.kbd-hint {
  font-family: 'Work Sans', sans-serif;
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--titanium-fade);
  margin-right: 16px;
}
.kbd-hint kbd {
  display: inline-block;
  padding: 2px 6px;
  background: rgba(226, 226, 225, 0.08);
  border: 1px solid rgba(226, 226, 225, 0.15);
  font-family: inherit;
  margin: 0 2px;
}

/* Intro screen */
.intro-greeting {
  font-family: 'Work Sans', sans-serif;
  font-weight: 500;
  font-size: 44px;
  line-height: 1.2;
  margin-bottom: 24px;
  color: #ffffff;
  letter-spacing: -0.6px;
}
.intro-greeting strong {
  font-weight: 700;
  color: var(--teal);
}
.intro-body {
  font-size: 18px;
  color: var(--titanium-dim);
  margin-bottom: 32px;
  max-width: 520px;
  line-height: 1.6;
}
.intro-meta {
  display: flex;
  gap: 32px;
  margin-bottom: 56px;
  padding-top: 24px;
  border-top: 1px solid rgba(226, 226, 225, 0.08);
  flex-wrap: wrap;
}
.intro-meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.intro-meta-label {
  font-family: 'Work Sans', sans-serif;
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--titanium-fade);
}
.intro-meta-value {
  font-family: 'Work Sans', sans-serif;
  font-weight: 500;
  font-size: 16px;
  color: var(--titanium);
}
.intro-cta {
  background: var(--teal);
  color: var(--space);
  border: none;
  font-family: 'Work Sans', sans-serif;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 22px 56px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 14px;
}
.intro-cta:hover {
  background: #6affe0;
  transform: translateY(-1px);
}
.intro-cta .arrow { font-size: 20px; }

/* Success screen */
.success-icon {
  width: 56px;
  height: 56px;
  border: 1px solid var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 32px;
}
.success-icon svg {
  width: 24px;
  height: 24px;
  stroke: var(--teal);
  stroke-width: 2;
  fill: none;
}
.success-title {
  font-family: 'Work Sans', sans-serif;
  font-weight: 500;
  font-size: 36px;
  line-height: 1.2;
  margin-bottom: 16px;
  color: #ffffff;
  letter-spacing: -0.4px;
}
.success-title strong {
  font-weight: 700;
  color: var(--teal);
}
.success-body {
  font-size: 16px;
  color: var(--titanium-dim);
  margin-bottom: 32px;
  max-width: 520px;
}

/* Optional tag (Q6 bonus) */
.optional-tag {
  display: inline-block;
  font-family: 'Work Sans', sans-serif;
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--space);
  background: var(--titanium-fade);
  padding: 4px 10px;
  margin-left: 12px;
  vertical-align: middle;
  border-radius: 1px;
}

/* Honeypot — visually hidden but accessible to bots that scrape and fill
   labelled inputs. Backend handler in src/admin/report-feedback.ts
   silently 200s if `body.phone` is populated. `.fr-` prefix matches the
   form's namespace convention to avoid theme-wide class collision. */
.fr-hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Toast (transient submission errors) */
.fr-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  background: var(--space-lighter);
  border: 1px solid var(--error);
  color: #ffffff;
  font-family: 'Work Sans', sans-serif;
  font-size: 13px;
  letter-spacing: 0.5px;
  padding: 14px 24px;
  max-width: 420px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.fr-toast.show { opacity: 1; }

/* Mobile breakpoint */
@media (max-width: 640px) {
  .flow { padding: 90px 16px 140px; }
  .progress-inner { padding: 14px 16px; gap: 16px; }
  .progress-label { font-size: 10px; letter-spacing: 1.5px; }
  .question { font-size: 28px; line-height: 1.3; }
  .intro-greeting { font-size: 32px; }
  .intro-body { font-size: 16px; }
  .intro-meta { gap: 20px; }

  .scale-row { gap: 8px; }
  .scale-button { min-width: 48px; height: 56px; font-size: 16px; }
  .scale-row.eleven .scale-button { height: 48px; font-size: 14px; min-width: 36px; padding: 0 4px; }

  .consent-toggle-row { flex-direction: column; }
  .consent-button { height: 56px; }

  .nav-inner { padding: 14px 16px; }
  .nav-next { padding: 16px 28px; font-size: 12px; }
  .kbd-hint { display: none; }
  .nav-skip { font-size: 11px; }
}
