/* Dessert phone survey: portrait phones first, held at arm's length, often one-handed.
   Light only — a survey people meet once shouldn't surprise them with a theme. */

:root {
  --ground: #fff8f0;
  --surface: #ffffff;
  --edge: #ecdccb;
  --ink: #2b1d14;
  --ink-soft: #7b6553;
  --accent: #d9480f;          /* the same accent as the booth app */
  --bar: #2a78d6;
  --bar-you: #eb6834;
  --good: #1f7a4d;
  --ui: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 17px;            /* comfortably readable on a phone without zooming */
  line-height: 1.5;
}

.page {
  max-width: 34rem;
  margin: 0 auto;
  padding: 1.25rem 1rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
}

.stack { display: flex; flex-direction: column; gap: 1rem; }

h1 { font-size: 1.7rem; line-height: 1.2; margin: 0; text-wrap: balance; }
h2 { font-size: 1.1rem; margin: 0 0 0.5rem; }

.eyebrow {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.lede { margin: 0; font-size: 1.05rem; }
.footnote { margin: 0; font-size: 0.87rem; color: var(--ink-soft); }
.count { margin: 0; font-size: 1.05rem; }

/* ---- Welcome screen ---------------------------------------------------------------
   Shaped like a product landing page rather than a consent form: an illustration, one
   promise, the button, then how it works. The disclosure people must see (that this is an
   AI) stays above the fold; the rest is one tap away in <details>. */

.welcome { display: flex; flex-direction: column; gap: 1.5rem; padding-top: 0.5rem; }

.hero { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; text-align: center; }

.hero-chef {
  width: 6rem;
  height: 6rem;
  border-radius: 50%;
  box-shadow: 0 10px 28px rgba(105, 70, 40, 0.18);
}

.hero h1 { font-size: 2rem; line-height: 1.15; letter-spacing: -0.02em; }

.tagline {
  margin: 0;
  font-size: 1.08rem;
  color: var(--ink-soft);
  max-width: 24rem;
  text-wrap: balance;
}

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.2rem 0 0;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: #fdeee4;
  border: 1px solid #f3d6c2;
  font-size: 0.88rem;
  font-weight: 600;
  color: #8a3a12;
}

.reassure {
  margin: -0.4rem 0 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.steps {
  margin: 0;
  padding: 1.1rem;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 1rem;
}

.steps li { display: grid; grid-template-columns: 1.85rem 1fr; gap: 0.75rem; align-items: start; }

.step-mark {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

/* One span per step, so a <strong> can't become its own grid cell and break the line. */
.step-text { font-size: 0.95rem; color: var(--ink-soft); }
.step-text strong { display: block; color: var(--ink); font-size: 1rem; margin-bottom: 0.1rem; }

.disclosure { border: 1px solid var(--edge); border-radius: 1rem; background: var(--surface); }
.disclosure summary { padding: 0.9rem 1.1rem; font-weight: 600; font-size: 0.95rem; }
.disclosure-body { padding: 0 1.1rem 1rem; }
.disclosure-body p { margin: 0 0 0.7rem; font-size: 0.9rem; color: var(--ink-soft); }
.disclosure-body p:last-child { margin-bottom: 0; }

.welcome-foot { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; text-align: center; }
.fineprint { margin: 0; font-size: 0.78rem; color: var(--ink-soft); }

.notice {
  margin: 0;
  background: #fdf0e6;
  border: 1px solid var(--edge);
  border-left: 4px solid var(--accent);
  border-radius: 0.5rem;
  padding: 0.75rem;
  font-size: 0.95rem;
}

/* ---- Buttons: big enough for a thumb ---------------------------------------------- */

button, .as-button {
  font: inherit;
  border-radius: 0.75rem;
  cursor: pointer;
  min-height: 3rem;
}

.primary {
  width: 100%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 1.05rem;
  padding: 0.85rem 1rem;
}

.primary:disabled { opacity: 0.45; }

.as-button {
  display: block;
  text-align: center;
  text-decoration: none;
  padding: 0.85rem 1rem;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.quiet {
  border: 1px solid var(--edge);
  background: transparent;
  color: var(--ink-soft);
  padding: 0.7rem 1rem;
  width: 100%;
  font-size: 0.95rem;
}

.secondary-link { color: var(--accent); font-size: 0.95rem; }

/* ---- Interview -------------------------------------------------------------------- */

.progress { margin: 0; font-size: 0.85rem; color: var(--ink-soft); }

.chat { display: flex; flex-direction: column; gap: 0.75rem; }

.turn { display: grid; grid-template-columns: 2rem 1fr; gap: 0.5rem; align-items: start; }
.turn.me { grid-template-columns: 1fr 2rem; }
.turn.me .who { order: 2; }
.turn.me .bubble { order: 1; background: #e7eef8; }

.who { font-size: 1.3rem; line-height: 1.6rem; text-align: center; }

.bubble {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 0.85rem;
  padding: 0.65rem 0.8rem;
}

/* While the interviewer is composing. Three dots in a bubble read as "it's working" far better
   than a line of grey text, and they sit where the answer will appear. */
.typing .bubble { display: flex; gap: 0.3rem; align-items: center; padding: 0.85rem 0.9rem; }

.typing i {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--ink-soft);
  animation: blink 1.2s ease-in-out infinite;
}

.typing i:nth-child(2) { animation-delay: 0.18s; }
.typing i:nth-child(3) { animation-delay: 0.36s; }

@keyframes blink {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-0.15rem); }
}

.composer { display: flex; flex-direction: column; gap: 0.6rem; }

textarea {
  width: 100%;
  font: inherit;
  font-size: 1.05rem;   /* 16px+ stops iOS zooming the page when the keyboard opens */
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 0.75rem;
  padding: 0.7rem;
  resize: vertical;
}

textarea:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(217, 72, 15, 0.45);
  outline-offset: 2px;
}

/* Both buttons are thumb-sized and both say what they do. The microphone button carries its own
   label because "tap it again to stop" in a status line below is too easy to miss — a respondent
   left recording indefinitely is the worst failure here. */
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; align-items: stretch; }

.mic {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 2px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-size: 1rem;
  font-weight: 600;
  border-radius: 0.75rem;
  padding: 0.85rem 0.5rem;
}

.mic .glyph { font-size: 1.2rem; line-height: 1; }

.mic[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
  animation: pulse 1.3s ease-in-out infinite;
}

.mic:disabled { opacity: 0.4; }
.send { margin: 0; }
.status { margin: 0; min-height: 1.25rem; font-size: 0.87rem; color: var(--ink-soft); }
.status.error { color: #a3301a; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217, 72, 15, 0.45); }
  50% { box-shadow: 0 0 0 0.6rem rgba(217, 72, 15, 0); }
}

/* ---- Charts ----------------------------------------------------------------------- */

.chart { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.chart li { display: flex; flex-direction: column; gap: 0.2rem; }
.chart .name { font-size: 0.92rem; }
.chart .tag { color: var(--bar-you); font-weight: 700; }

.track { background: #efe4d4; border-radius: 0.4rem; height: 1.5rem; overflow: hidden; }

.fill {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  min-width: 1.6rem;
  padding-right: 0.4rem;
  background: var(--bar);
  color: #fff;
  font-size: 0.8rem;
  border-radius: 0.4rem;
}

.you .fill { background: var(--bar-you); }

.reasons { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: 0.4rem; }
.reasons li { font-size: 0.95rem; }

details { border: 1px solid var(--edge); border-radius: 0.75rem; background: var(--surface); }
summary { padding: 0.75rem; cursor: pointer; font-size: 0.95rem; }
.transcript { padding: 0 0.75rem 0.75rem; font-size: 0.92rem; }
.transcript p { margin: 0 0 0.5rem; }

/* Shown only on a device with read-aloud switched on, so an operator can see the mode at a
   glance rather than wondering why the laptop is or isn't talking. */
.voice-pill {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  /* Top, not bottom: at the bottom it sat over the "I'm finished" button. */
  top: calc(0.5rem + env(safe-area-inset-top, 0px));
  margin: 0;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: rgba(43, 29, 20, 0.85);
  color: #fff8f0;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .mic[aria-pressed="true"] { animation: none; }
  .typing i { animation: none; opacity: 0.6; }
}
