/* ─── Assessment Form Styles ────────────────────────────────────────────────── */

/* ─── Cover page ────────────────────────────────────────────────────────────── */
.form-cover {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.cover-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.cover-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
}

.cover-orb-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(45,212,191,0.4) 0%, transparent 70%);
  top: -15%;
  right: -10%;
  animation: orbFloat1 12s ease-in-out infinite;
}

.cover-orb-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(99,102,241,0.35) 0%, transparent 70%);
  bottom: -10%;
  left: -8%;
  animation: orbFloat2 14s ease-in-out infinite;
}

.cover-orb-3 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(45,212,191,0.2) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: orbFloat3 10s ease-in-out infinite;
}

@keyframes orbFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-40px, 30px) scale(1.1); }
}
@keyframes orbFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(30px, -25px) scale(1.05); }
}
@keyframes orbFloat3 {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.3; }
  50%      { transform: translate(-50%, -50%) scale(1.15); opacity: 0.5; }
}

.cover-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2rem;
  animation: coverFadeIn 800ms ease-out both;
}

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

.cover-logo {
  display: block;
  height: 20px;
  width: auto;
  margin: 0 auto 2.5rem;
  opacity: 0.45;
}

.cover-title {
  font-size: clamp(2rem, 5.5vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 1rem;
}

@media (min-width: 600px) {
  .cover-title .mobile-break {
    display: none;
  }
}

.cover-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  margin-bottom: 2.5rem;
}

.cover-time-estimate {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-subtle);
  letter-spacing: 0.02em;
  margin-bottom: 2rem;
}

.cover-start-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 160px;
  padding: 0.875rem 2.5rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--bg);
  background: var(--teal);
  border: none;
  border-radius: 100px;
  cursor: pointer;
  transition: transform 200ms var(--transition), box-shadow 200ms var(--transition), background 200ms var(--transition);
  box-shadow: 0 4px 24px rgba(45,212,191,0.25);
}

.cover-start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(45,212,191,0.35);
  background: #5eead4;
}

.cover-start-btn:active {
  transform: translateY(0) scale(0.98);
}

/* Cover exit animation */
.form-cover.cover-exit {
  animation: coverExit 500ms ease-in forwards;
}

@keyframes coverExit {
  to { opacity: 0; transform: scale(1.02); }
}

/* Form entrance after cover exit */
.form-enter #form-content,
.form-enter .progress-bar-wrap,
.form-enter .submit-bar {
  animation: formSlideIn 600ms cubic-bezier(0.22,1,0.36,1) both;
}
.form-enter .progress-bar-wrap { animation-delay: 0ms; }
.form-enter #form-content      { animation-delay: 100ms; }
.form-enter .submit-bar         { animation-delay: 200ms; }

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

/* ─── Question prefix banner (repeats every 10 questions) ───────────────────── */
.question-prefix-banner {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1.5rem 0 0.5rem;
  margin-top: 0.5rem;
}

.question-section-header {
  font-size: 1rem;
  font-weight: 700;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2rem 0 0.75rem;
  margin-top: 1rem;
  border-top: 1px solid var(--border);
}
.question-section-header:first-child {
  border-top: none;
  margin-top: 0;
  padding-top: 0.5rem;
}

/* ─── Brand heading (inside sticky progress bar) ───────────────────────────── */
.form-brand-heading {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--teal);
  max-width: 680px;
  margin: 0 auto;
  padding: 0.25rem 1.25rem 0.375rem;
}

/* ─── Form page layout ───────────────────────────────────────────────────────── */
.form-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 1.25rem 6rem;
  position: relative;
}

/* ─── Progress bar ───────────────────────────────────────────────────────────── */
.progress-bar-wrap {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  background: rgba(15,17,23,0.92);
}

.progress-bar-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.progress-track {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 100px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--teal);
  border-radius: 100px;
  transition: width 300ms cubic-bezier(0.4,0,0.2,1);
  width: 0%;
}

.progress-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 50px;
  text-align: right;
}

/* ─── Intro card ─────────────────────────────────────────────────────────────── */
.form-intro-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  margin: 1.75rem 0 1.25rem;
  box-shadow: var(--shadow-card);
}

.form-wordmark {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--teal);
  letter-spacing: -0.03em;
  display: block;
  margin-bottom: 1rem;
}
.form-wordmark span { color: var(--text); }

.form-intro-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
  line-height: 1.5;
}

.form-prefix {
  font-size: 0.9375rem;
  color: var(--teal);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.form-instructions {
  font-size: 0.875rem;
  color: var(--text-muted);
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  margin-top: 0.75rem;
  line-height: 1.6;
}

/* ─── Scroll-reveal for cards ────────────────────────────────────────────────── */
.scroll-reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 400ms cubic-bezier(0.22,1,0.36,1), transform 400ms cubic-bezier(0.22,1,0.36,1);
}
.scroll-reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Question card ──────────────────────────────────────────────────────────── */
.question-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.125rem 1.25rem;
  margin-bottom: 0.625rem;
  transition: opacity 400ms cubic-bezier(0.22,1,0.36,1), transform 400ms cubic-bezier(0.22,1,0.36,1), border-color 200ms var(--transition), box-shadow 200ms var(--transition);
}

.question-card.unanswered {
  border-color: var(--red);
  box-shadow: 0 0 0 2px rgba(248,113,113,0.18);
  animation: shakeQuestion 400ms var(--transition);
}

@keyframes shakeQuestion {
  0%   { transform: translateX(0); }
  20%  { transform: translateX(-5px); }
  40%  { transform: translateX(5px); }
  60%  { transform: translateX(-4px); }
  80%  { transform: translateX(3px); }
  100% { transform: translateX(0); }
}

.question-number {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-bottom: 0.4rem;
}

.question-text {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.55;
  margin-bottom: 0.875rem;
}

/* ─── Radio pill buttons ─────────────────────────────────────────────────────── */
.radio-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.radio-pill {
  position: relative;
}

.radio-pill input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-pill label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border: 2px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  transition:
    background 150ms var(--transition),
    border-color 150ms var(--transition),
    color 150ms var(--transition),
    transform 120ms var(--transition);
  color: var(--text-muted);
  background: transparent;
  white-space: nowrap;
  user-select: none;
  text-transform: none;
  letter-spacing: 0;
}

.radio-pill label:hover {
  background: rgba(255,255,255,0.05);
  border-color: var(--border-hover);
  color: var(--text);
}

/* Selected state */
.radio-pill input:checked + label {
  background: rgba(45,212,191,0.15);
  border-color: var(--teal);
  border-width: 2px;
  color: var(--teal);
  font-weight: 600;
}

/* All selected answers use the same neutral style — no colour coding */

/* Brief flash when answer is recorded */
.question-card.answer-flash {
  border-color: rgba(45,212,191,0.4);
  box-shadow: 0 0 0 2px rgba(45,212,191,0.12);
}

.radio-pill label:active { transform: scale(0.97); }

/* Dot indicator on pill — collapses to zero width when unchecked so the
   label text stays visually centred within the pill. */
.radio-pill-dot {
  width: 0;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0;
  transform: scale(0);
  margin-right: -0.35rem; /* collapses the flex gap when invisible */
  transition: opacity 150ms, transform 150ms, width 150ms, margin-right 150ms;
}
.radio-pill input:checked + label .radio-pill-dot {
  width: 6px;
  opacity: 1;
  transform: scale(1);
  margin-right: 0;
}

/* ─── Sticky submit bar ──────────────────────────────────────────────────────── */
.submit-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15,17,23,0.95);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(8px);
  padding: 0.875rem 1.25rem;
  z-index: 100;
  display: flex;
  justify-content: center;
}

.submit-bar-inner {
  width: 100%;
  max-width: 680px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.submit-bar-hint {
  font-size: 0.8125rem;
  color: var(--text-subtle);
}

.submit-bar-hint.clickable {
  color: #2dd4bf;
  cursor: pointer;
  font-weight: 500;
  border-bottom: 1px dashed rgba(45, 212, 191, 0.5);
  padding-bottom: 1px;
  transition: color 0.15s, border-color 0.15s;
}
.submit-bar-hint.clickable:hover {
  color: #5eead4;
  border-bottom-color: #5eead4;
}
.submit-bar-hint.clickable:focus-visible {
  outline: 2px solid rgba(45, 212, 191, 0.6);
  outline-offset: 3px;
  border-radius: 2px;
}
.submit-bar-hint-arrow {
  display: inline-block;
  margin-left: 4px;
  transition: transform 0.15s;
}
.submit-bar-hint.clickable:hover .submit-bar-hint-arrow {
  transform: translateY(2px);
}

/* Submit button ready state (all answered) */
#submit-btn:not(:disabled) {
  box-shadow: 0 0 16px rgba(45,212,191,0.3), 0 0 4px rgba(45,212,191,0.15);
  animation: submitPulse 2s ease-in-out infinite;
}
@keyframes submitPulse {
  0%, 100% { box-shadow: 0 0 16px rgba(45,212,191,0.3), 0 0 4px rgba(45,212,191,0.15); }
  50%      { box-shadow: 0 0 24px rgba(45,212,191,0.45), 0 0 8px rgba(45,212,191,0.2); }
}

/* Submitting state */
#submit-btn.submitting {
  pointer-events: none;
  opacity: 0.85;
}
#submit-btn.submitting::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 600ms linear infinite;
  margin-right: 0.5rem;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Full-page overlays (thank you / error) ─────────────────────────────────── */
.form-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  animation: overlayIn 400ms var(--transition) forwards;
}

@keyframes overlayIn { to { opacity: 1; } }

.overlay-card {
  text-align: center;
  max-width: 460px;
  padding: 2rem;
}

.overlay-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
}

.overlay-icon.success {
  background: rgba(45,212,191,0.12);
  color: var(--teal);
  animation: successPop 500ms cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes successPop {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.overlay-icon.error {
  background: rgba(248,113,113,0.12);
  color: var(--red);
}

.overlay-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
  animation: overlayTextIn 400ms ease-out 300ms both;
}

.overlay-message {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.7;
  animation: overlayTextIn 400ms ease-out 450ms both;
}

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

/* ─── Loading state ──────────────────────────────────────────────────────────── */
.form-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 1rem;
  color: var(--text-muted);
}

/* ─── Error state (inline) ───────────────────────────────────────────────────── */
.form-error-inline {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  background: rgba(248,113,113,0.1);
  border: 1px solid rgba(248,113,113,0.25);
  border-radius: var(--radius-xs);
  color: var(--red);
  font-size: 0.875rem;
  display: none;
}
.form-error-inline.show { display: block; }

/* ─── Section divider ────────────────────────────────────────────────────────── */
.form-section-divider {
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--teal) 30%, var(--teal) 70%, transparent 100%);
  margin: 2.5rem 0;
  opacity: 0.4;
}

/* ─── Extras sections (matrix + share consent) ──────────────────────────────── */
.extras-section {
  margin-top: 1.5rem;
}

.extras-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1.5rem;
  transition: border-color 200ms var(--transition), box-shadow 200ms var(--transition);
}

.extras-card.unanswered {
  border-color: var(--red);
  box-shadow: 0 0 0 2px rgba(248,113,113,0.18);
}

.extras-question {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.55;
  margin-bottom: 0.75rem;
}

.extras-subtext {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 0.625rem;
}

.extras-instruction {
  font-size: 0.8125rem;
  color: var(--text-subtle);
  margin: 1rem 0 0;
  line-height: 1.5;
  font-style: italic;
}

/* ─── Matrix grid (strongest / least strong) ────────────────────────────────── */
.matrix-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.matrix-header {
  display: grid;
  grid-template-columns: 1fr 100px 120px;
  gap: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
}

.matrix-header-label {
  /* empty spacer */
}

.matrix-header-col {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
}

.matrix-row {
  display: grid;
  grid-template-columns: 1fr 100px 120px;
  gap: 0.5rem;
  align-items: center;
  padding: 0.625rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 150ms;
}

.matrix-row:last-of-type {
  border-bottom: none;
}

.matrix-row:hover {
  background: rgba(255,255,255,0.02);
}

.matrix-row.matrix-conflict {
  background: rgba(248,113,113,0.08);
}

.matrix-label {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: baseline;
}

.matrix-label-text {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.45;
}

.matrix-label-behaviour {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-subtle);
  line-height: 1.45;
}

.matrix-cell {
  display: flex;
  justify-content: center;
  align-items: center;
}

.matrix-cell input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.matrix-radio-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  transition: border-color 150ms, background 150ms;
}

.matrix-radio-label:hover {
  border-color: var(--border-hover);
  background: rgba(255,255,255,0.05);
}

.matrix-cell input:checked + .matrix-radio-label {
  border-color: var(--teal);
  background: rgba(45,212,191,0.15);
}

.matrix-radio-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--teal);
  opacity: 0;
  transform: scale(0);
  transition: opacity 150ms, transform 150ms;
}

.matrix-cell input:checked + .matrix-radio-label .matrix-radio-dot {
  opacity: 1;
  transform: scale(1);
}

.matrix-conflict-note {
  font-size: 0.8125rem;
  color: var(--red);
  padding: 0.5rem 0 0;
}

/* ─── Share consent options ──────────────────────────────────────────────────── */
.share-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.share-options .radio-pill label {
  white-space: normal;
}

/* ─── Scrollbar ──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 500px) {
  .form-page { padding: 0 0.875rem 6rem; }
  .radio-group {
    flex-direction: column;
    gap: 0.375rem;
  }
  .radio-pill label {
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    width: 100%;
    justify-content: flex-start;
  }
  .form-intro-card { padding: 1.25rem; }
  .question-card { padding: 1rem; }
  .extras-card { padding: 1rem; }
  .submit-bar-hint { display: none; }

  /* Matrix: stack label above radio columns on small screens */
  .matrix-header {
    grid-template-columns: 1fr 80px 100px;
  }
  .matrix-row {
    grid-template-columns: 1fr 80px 100px;
  }
  .matrix-label-text { font-size: 0.8125rem; }
  .matrix-label-behaviour { font-size: 0.75rem; }
}
