/* Qualitative interview: same look as emotion-rating-study/frontend/styles/main.css.
   Warm off-white ground, deep academic green accent, Fraunces + IBM Plex Sans. */

:root {
  --bg: #FAFAF7;
  --bg-elevated: #FFFFFF;
  --ink: #0F0F0F;
  --ink-2: #3A3A3A;
  --ink-3: #6B6B6B;
  --ink-4: #9B9A94;
  --rule: #E0DFD9;
  --rule-strong: #C9C7BF;
  --accent: #2D4A2B;
  --accent-hover: #1F3620;
  --accent-wash: rgba(45, 74, 43, 0.08);
  --error: #8B1E2D;
  --font-display: 'Fraunces', 'Playfair Display', Georgia, serif;
  --font-body: 'IBM Plex Sans', -apple-system, system-ui, sans-serif;
  --radius: 2px;
  --radius-lg: 4px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --max-narrow: 680px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

/* Logos, as in the emotion study */
.survey-logo-header { width: 100%; padding: 20px 16px 12px; border-bottom: 1px solid var(--rule); background: var(--bg); }
.institution-logos { display: flex; align-items: center; justify-content: center; gap: clamp(16px, 3vw, 32px); flex-wrap: wrap; }
.institution-logos img { display: block; width: auto; max-width: 100%; object-fit: contain; }
.logo-mit { height: 38px; }
.logo-harvard { height: 46px; }
.logo-northwestern { height: 30px; }

.progress { height: 3px; background: var(--rule); position: sticky; top: 0; z-index: 2; }
.progress__fill { display: block; height: 100%; width: 0; background: var(--accent); transition: width 600ms var(--ease); }

.screen { flex: 1; width: 100%; max-width: var(--max-narrow); margin: 0 auto; padding: 32px 16px; }
.screen--center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; }

.card { background: var(--bg-elevated); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: clamp(24px, 4vw, 40px); }
.eyebrow { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 8px; }
.display { font-family: var(--font-display); font-weight: 500; font-size: clamp(24px, 4vw, 30px); line-height: 1.2; margin: 0 0 20px; letter-spacing: -0.01em; }
.card p { color: var(--ink-2); margin: 0 0 14px; }
.card a { color: var(--accent); }
.key-term { padding: 0 0.18em; border-radius: 3px; background: var(--accent-wash); color: var(--accent); font-weight: 650; }
.study-lead { padding-top: 4px; color: var(--ink-2); }
.study-lead strong { color: var(--ink); font-weight: 700; }
/* Same badge as the emotion-study entry pages (.onboarding-irb). */
.irb-badge {
  display: inline-flex; align-items: baseline; gap: 0.32em;
  margin: 4px 0 18px !important; padding: 7px 11px;
  border: 1px solid #b9c7bd; border-radius: 4px; background: #f4f8f5;
  color: #294232 !important; font-size: 0.89rem; line-height: 1.35;
}
.card__actions { margin-top: 4px; }
.muted { color: var(--ink-3); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 10px 20px;
  border-radius: var(--radius); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; font-weight: 500;
  transition: background var(--ease) 120ms, border-color var(--ease) 120ms;
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn--primary:disabled { background: var(--rule-strong); cursor: not-allowed; }
.btn--ghost { background: transparent; border-color: var(--rule-strong); color: var(--ink-2); }
.btn--ghost:hover { border-color: var(--ink-3); }
.card .btn { margin-top: 8px; }

.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--rule); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Chat */
.screen--chat { display: flex; flex-direction: column; padding-top: 20px; padding-bottom: 0; }
.messages { display: flex; flex-direction: column; gap: 10px; padding-bottom: 12px; }
.bubble {
  max-width: 88%;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  white-space: normal;
  overflow-wrap: anywhere;
  animation: rise 260ms var(--ease);
}
.bubble p { margin: 0; }
.bubble p + p { margin-top: 10px; }
.bubble--ai { align-self: flex-start; background: var(--bg-elevated); border: 1px solid var(--rule); color: var(--ink); }
.bubble--me { align-self: flex-end; background: var(--accent-wash); border: 1px solid rgba(45, 74, 43, 0.18); color: var(--ink); }
.bubble--choice { font-style: normal; }
.bubble--pending { opacity: 0.6; }
.bubble--safety { border-color: var(--error); }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.typing { display: inline-flex; gap: 5px; align-items: center; width: auto; margin: 0 0 12px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-4); animation: blink 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

.options {
  align-self: flex-end;
  width: min(100%, 560px);
  margin-left: auto;
  display: flex; flex-direction: column; gap: 8px;
  padding: 6px 0 24px;
}
.options__label {
  align-self: flex-end;
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent);
  margin: 0 2px 2px;
}
.option {
  display: flex; align-items: flex-start; gap: 12px;
  width: 100%; text-align: left;
  padding: 12px 16px; min-height: 48px;
  background: #F1F5F0;
  border: 1.5px solid var(--accent);
  border-radius: 12px;
  color: var(--accent-hover);
  font-weight: 500; line-height: 1.45;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(45, 74, 43, 0.12);
  transition: background 120ms var(--ease), color 120ms var(--ease), transform 120ms var(--ease);
}
.option::before {
  content: '';
  flex: none;
  width: 18px; height: 18px; margin-top: 2px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  background: #fff;
  transition: box-shadow 120ms var(--ease), background 120ms var(--ease);
}
.option:hover:not(:disabled) { background: var(--accent); color: #fff; }
.option:hover:not(:disabled)::before { border-color: #fff; }
.option:active:not(:disabled) { transform: translateY(1px); }
.option:focus-visible { outline: 3px solid rgba(45, 74, 43, 0.35); outline-offset: 2px; }
.option:disabled { cursor: default; opacity: 0.45; }
.option--chosen { background: var(--accent); color: #fff; opacity: 1 !important; }
.option--chosen::before { border-color: #fff; background: var(--accent); box-shadow: inset 0 0 0 4px #fff; }

.composer {
  position: sticky; bottom: 0;
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 0 max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, rgba(250, 250, 247, 0), var(--bg) 14px);
}
.composer textarea {
  width: 100%; resize: none; min-height: 52px; max-height: 40vh;
  padding: 13px 14px; font: inherit; color: var(--ink);
  background: var(--bg-elevated); border: 1px solid var(--rule-strong); border-radius: var(--radius-lg);
  outline: none;
}
.composer textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.composer textarea:disabled { background: #F2F1EC; }
.composer__actions { display: flex; justify-content: flex-end; gap: 8px; }

.error { border: 1px solid var(--error); background: #FBF3F4; color: var(--error); border-radius: var(--radius-lg); padding: 12px 16px; margin: 0 0 16px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.error p { margin: 0; }

.done { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 8px 0 32px; }

@media (max-width: 560px) {
  .survey-logo-header { padding: 14px 16px 10px; }
  .institution-logos { gap: 18px; }
  .logo-mit { height: 28px; }
  .logo-harvard { height: 34px; }
  .logo-northwestern { height: 22px; }
  .bubble { max-width: 94%; }
  .screen { padding: 24px 16px; }
}
