/* Clarke Center Imagination Survey: mobile-first, mirrors the Qualtrics theme */

:root {
  --ink: #2d3748;
  --ink-soft: #4a5568;
  --ink-faint: #6b7280;
  --accent: #1976d2;
  --accent-deep: #1565c0;
  --box: #f0f0f0;
  --box-border: #e2e8f0;
  --info-bg: #eef2f9;
  --page-max: 780px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #ffffff;
  color: var(--ink);
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

/* ---------- progress header ---------- */
.progress-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(6px);
  padding: 12px 16px 10px;
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 420px;
  margin: 0 auto;
}

.progress-label {
  font-size: 12.5px;
  color: var(--ink-soft);
  font-weight: 500;
  flex-shrink: 0;
}

.progress-track {
  flex: 1;
  height: 7px;
  background: #e8e8e8;
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- shell ---------- */
.survey-shell {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 8px 20px calc(48px + env(safe-area-inset-bottom));
}

.logo-wrap { text-align: center; padding: 18px 0 6px; }
.logo { width: 190px; max-width: 60%; height: auto; }

.page { animation: fadeIn 0.35s ease; }

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

/* ---------- questions ---------- */
.question {
  margin: 26px 0;
  scroll-margin-top: 80px;
}

.question.invalid { animation: shake 0.3s ease; }
.question.invalid .q-text::after {
  content: 'Please answer this question.';
  display: block;
  color: #c62828;
  font-size: 14px;
  margin-top: 6px;
  font-weight: 500;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.q-text { margin-bottom: 14px; }
.q-text h2 { font-size: 1.35rem; }
.q-text a { color: var(--accent); }

/* Qualtrics HTML uses <p><br></p> / <div><br></div> spacers between
   paragraphs, which balloon at mobile sizes. Hide the spacers and use a
   consistent modest paragraph gap instead. */
.q-text p, .q-text div div, .q-text h2 { margin: 0 0 0.85em; }
.q-text p:has(> br:only-child),
.q-text div:has(> br:only-child) { display: none; }

/* Inline font-family on Qualtrics cards (Arial) fights the site theme */
.q-text [style*="font-family"] { font-family: inherit !important; }

.info-card {
  background: var(--info-bg);
  border: 1px solid #dfe7f3;
  border-radius: 10px;
  padding: 18px 20px;
  margin: 18px 0;
}

/* ---------- choice rows (radio / checkbox) ---------- */
.choice-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: var(--box);
  border: 2px solid transparent;
  border-radius: 6px;
  padding: 13px 15px;
  margin: 7px 0;
  cursor: pointer;
  font: inherit;
  color: var(--ink-soft);
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.choice-row:active { background: #e8e8e8; }

.choice-row .mark {
  flex-shrink: 0;
  width: 21px;
  height: 21px;
  border: 2px solid #9aa2af;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.choice-row.radio .mark { border-radius: 50%; }
.choice-row.check .mark { border-radius: 4px; }

.choice-row.selected {
  border-color: var(--accent);
  background: #e9f2fc;
  color: var(--ink);
}

.choice-row.selected .mark {
  border-color: var(--accent);
  background: var(--accent);
}

.choice-row.selected .mark::after {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
}

.choice-row.check.selected .mark::after {
  width: 11px;
  height: 6px;
  border-left: 2.5px solid #fff;
  border-bottom: 2.5px solid #fff;
  border-radius: 0;
  background: none;
  transform: rotate(-45deg) translate(1px, -1px);
}

.other-input {
  width: 100%;
  margin: 2px 0 6px;
  padding: 11px 13px;
  font: inherit;
  border: 2px solid var(--box-border);
  border-radius: 6px;
}

/* ---------- scale (1-10 horizontal radio) ---------- */
.scale-anchors {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-faint);
  margin: 14px 0 12px;
}

.scale-anchors span { width: 32%; }
.scale-anchors span:nth-child(2) { text-align: center; }
.scale-anchors span:nth-child(3) { text-align: right; }

/* One continuous row: the scale is a left-to-right continuum matching the
   anchor labels, so it must never wrap. Tap or press-and-slide to select. */
.scale-readout {
  text-align: center;
  margin-bottom: 5px;
}

.scale-readout.empty { color: #b9c0cc; font-size: 14px; }

.scale-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 0;
  border-radius: 10px;
  overflow: hidden;
  touch-action: pan-y;   /* horizontal slides select; vertical still scrolls */
  user-select: none;
  -webkit-user-select: none;
  margin-bottom: 54px;   /* breathing room before the next question */
}

.scale-btn {
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  padding: 0;
  min-height: 56px;
  background: var(--box);
  color: var(--ink-soft);
  border: none;
  border-right: 2px solid #fff;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.scale-btn:last-child { border-right: none; }

.scale-btn.selected {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ---------- sliders ---------- */
.slider-row { margin: 20px 0 8px; }
.slider-row .slider-title { font-weight: 500; margin-bottom: 4px; }

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-faint);
  margin-bottom: 4px;
}

.slider-wrap { display: flex; align-items: center; gap: 14px; }

.slider-value {
  flex-shrink: 0;
  min-width: 44px;
  text-align: center;
  font-weight: 600;
  color: var(--accent-deep);
  background: #e9f2fc;
  border-radius: 8px;
  padding: 6px 4px;
  font-variant-numeric: tabular-nums;
}

.slider-value.untouched { color: #9aa2af; background: var(--box); }

input[type="range"] {
  flex: 1;
  appearance: none;
  -webkit-appearance: none;
  height: 8px;
  border-radius: 99px;
  background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--pct, 0%), #e0e0e0 var(--pct, 0%), #e0e0e0 100%);
  outline: none;
  margin: 16px 0;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

/* ---------- text entry ---------- */
.text-input, .text-area {
  width: 100%;
  font: inherit;
  color: var(--ink);
  padding: 13px 15px;
  border: 2px solid var(--box-border);
  border-radius: 8px;
  background: #fafafa;
  transition: border-color 0.15s;
}

.text-input:focus, .text-area:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
}

.text-area { min-height: 110px; resize: vertical; }

/* ---------- nav ---------- */
.nav-row {
  display: flex;
  align-items: center;
  margin-top: 36px;
}

.nav-spacer { flex: 1; }

.nav-btn {
  width: 58px;
  height: 46px;
  font-size: 22px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.nav-btn:active { transform: scale(0.96); }

.nav-next {
  background: var(--accent);
  color: #fff;
}

.nav-next:hover { background: var(--accent-deep); }

.nav-next.submitting {
  opacity: 0.6;
  pointer-events: none;
}

.nav-back {
  background: var(--box);
  color: var(--ink-soft);
}

/* ---------- results ---------- */
.results-chart-card {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  border-radius: 20px;
  padding: 14px;
  margin: 20px 0;
}

.results-chart-card svg {
  background: #fff;
  border-radius: 15px;
  display: block;
  width: 100%;
  height: auto;
}

.persona-card {
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 18px 20px;
  margin: 16px 0;
  color: var(--ink-soft);
}

/* Persona names arrive as <u><b> from the original survey; underlines read
   as links on mobile, so keep just the bold. */
.persona-card u { text-decoration: none; }

.save-card {
  background: #f7fafc;
  border: 2px solid #cbd5e0;
  border-radius: 10px;
  padding: 16px 20px;
  margin: 16px 0;
}

.save-card h3 { text-align: center; margin-top: 0; }

.pdf-btn {
  display: block;
  margin: 6px auto 4px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  padding: 13px 28px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.pdf-btn:active { background: var(--accent-deep); }
.pdf-btn:disabled { opacity: 0.6; }

/* ---------- end page ---------- */
.end-card {
  text-align: center;
  padding: 60px 10px;
  font-size: 1.15rem;
}

/* ---------- submitting ---------- */
.submitting-card {
  text-align: center;
  padding: 90px 10px;
  color: var(--ink-soft);
}

.spinner {
  width: 44px;
  height: 44px;
  margin: 0 auto 18px;
  border: 4px solid #e3edf9;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 12px 22px;
  border-radius: 99px;
  font-size: 15px;
  z-index: 50;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  animation: fadeIn 0.25s ease;
  max-width: calc(100vw - 40px);
  text-align: center;
}
